delphi 数据库 出现过程'inprocduct' 需要参数'@ioinfo' 单未提供该参数
varinfo:string;beginifComboBox1.Text<>''thenifComboBox2.Text<>''thenifEdit4.Text<>''t...
var
info:string;
begin
if ComboBox1.Text<>'' then
if ComboBox2.Text<>'' then
if Edit4.Text<>'' then
if RadioButton1.Checked then
with ADOStoredProc1 do
begin
ProcedureName:='inproduct';
Parameters.Refresh;
Parameters.ParamByName('@ino').Value := Edit1.Text;
Parameters.ParamByName('@jinchu').Value := '进仓';
Parameters.ParamByName('@date').Value := FormatDateTime('yyyy-mm-dd',DateTimePicker1.Date);
Parameters.ParamByName('@mancode').Value := ComboBox1.Text;
Parameters.ParamByName('@wcode').Value := ComboBox2.Text;
Parameters.ParamByName('@wname').Value := Edit3.Text;
Parameters.ParamByName('@num').Value := Edit2.Text;
Parameters.ParamByName('@danwei').Value := Edit4.Text;
Parameters.ParamByName('@message').Value := Edit5.Text;
//Prepared:=true;
ExecProc;
info := Parameters.ParamByName('@ioinfo').Value;
edt1.Text:=info;
ShowMessage(info);
end
else if RadioButton2.Checked then
with ADOStoredProc1 do
begin
ProcedureName:='outproduct';
Parameters.Refresh;
Parameters.ParamByName('@ino').Value := Edit1.Text;
Parameters.ParamByName('@jinchu').Value := '进仓';
Parameters.ParamByName('@date').Value := FormatDateTime('yyyy-mm-dd',DateTimePicker1.Date);
Parameters.ParamByName('@mancode').Value := ComboBox1.Text;
Parameters.ParamByName('@wcode').Value := ComboBox2.Text;
Parameters.ParamByName('@wname').Value := Edit3.Text;
Parameters.ParamByName('@num').Value := Edit2.Text;
Parameters.ParamByName('@danwei').Value := Edit4.Text;
Parameters.ParamByName('@message').Value := Edit5.Text;
//Prepared:=true;
ExecProc;
info:= Parameters.ParamByName('@ioinfo').Value;
ShowMessage(info);
end
else
ShowMessage('请输入数量')
else
ShowMessage('请选择物料')
else
ShowMessage('请确定操作人员');
存储过程如下
数据库代码如下
create proc outproduct
@ino varchar(15),
@jinchu varchar(4),
@date datetime,
@mancode varchar(8),
@wcode int,
@wname char(15),
@num float,
@danwei varchar(5),
@message varchar(5),
@ioinfo char(20) output
as
declare @sum float
begin
SET XACT_ABORT ON
begin tran
select @sum=库存数量 from mater where 物料代码=@wcode
if @@ROWCOUNT <>0
begin
if @sum-@num<0
begin
set @ioinfo='操作失败,';
rollback tran
return 0
end
else
begin
begin tran
update mater set 库存数量=@sum-@num
where 物料代码=@wcode
insert into in_out values(@ino,@jinchu,@date,@mancode,@wcode,@wname,@num,@danwei,@message)
set @ioinfo='操作成功'
commit tran
end
end
else
begin
set @ioinfo='操作失败'
rollback tran
end
commit tran
end
go
试过了 没用 而且我是想把 sql的参数传出来 展开
info:string;
begin
if ComboBox1.Text<>'' then
if ComboBox2.Text<>'' then
if Edit4.Text<>'' then
if RadioButton1.Checked then
with ADOStoredProc1 do
begin
ProcedureName:='inproduct';
Parameters.Refresh;
Parameters.ParamByName('@ino').Value := Edit1.Text;
Parameters.ParamByName('@jinchu').Value := '进仓';
Parameters.ParamByName('@date').Value := FormatDateTime('yyyy-mm-dd',DateTimePicker1.Date);
Parameters.ParamByName('@mancode').Value := ComboBox1.Text;
Parameters.ParamByName('@wcode').Value := ComboBox2.Text;
Parameters.ParamByName('@wname').Value := Edit3.Text;
Parameters.ParamByName('@num').Value := Edit2.Text;
Parameters.ParamByName('@danwei').Value := Edit4.Text;
Parameters.ParamByName('@message').Value := Edit5.Text;
//Prepared:=true;
ExecProc;
info := Parameters.ParamByName('@ioinfo').Value;
edt1.Text:=info;
ShowMessage(info);
end
else if RadioButton2.Checked then
with ADOStoredProc1 do
begin
ProcedureName:='outproduct';
Parameters.Refresh;
Parameters.ParamByName('@ino').Value := Edit1.Text;
Parameters.ParamByName('@jinchu').Value := '进仓';
Parameters.ParamByName('@date').Value := FormatDateTime('yyyy-mm-dd',DateTimePicker1.Date);
Parameters.ParamByName('@mancode').Value := ComboBox1.Text;
Parameters.ParamByName('@wcode').Value := ComboBox2.Text;
Parameters.ParamByName('@wname').Value := Edit3.Text;
Parameters.ParamByName('@num').Value := Edit2.Text;
Parameters.ParamByName('@danwei').Value := Edit4.Text;
Parameters.ParamByName('@message').Value := Edit5.Text;
//Prepared:=true;
ExecProc;
info:= Parameters.ParamByName('@ioinfo').Value;
ShowMessage(info);
end
else
ShowMessage('请输入数量')
else
ShowMessage('请选择物料')
else
ShowMessage('请确定操作人员');
存储过程如下
数据库代码如下
create proc outproduct
@ino varchar(15),
@jinchu varchar(4),
@date datetime,
@mancode varchar(8),
@wcode int,
@wname char(15),
@num float,
@danwei varchar(5),
@message varchar(5),
@ioinfo char(20) output
as
declare @sum float
begin
SET XACT_ABORT ON
begin tran
select @sum=库存数量 from mater where 物料代码=@wcode
if @@ROWCOUNT <>0
begin
if @sum-@num<0
begin
set @ioinfo='操作失败,';
rollback tran
return 0
end
else
begin
begin tran
update mater set 库存数量=@sum-@num
where 物料代码=@wcode
insert into in_out values(@ino,@jinchu,@date,@mancode,@wcode,@wname,@num,@danwei,@message)
set @ioinfo='操作成功'
commit tran
end
end
else
begin
set @ioinfo='操作失败'
rollback tran
end
commit tran
end
go
试过了 没用 而且我是想把 sql的参数传出来 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询