调用存储过程前是不是最好先close一下,可是这样会出现问题,
db1.dh_insert.close
db1.dh_insert.Parameters.ParamByName('@dinghuohao').Value:=trim(labelededit1.Text);
db1.dh_insert.Parameters.ParamByName('@tuoyunren').Value:=trim(combobox1.Text);
报错说参数@dinghuohao找不到,可是明明是有这个参数的,把前面那个close去掉就好了。我以为是这个关系
可是在下一个存储过程中
db1.dh_update.Parameters.ParamByName('@dinghuoid').Value:=db1.dinghuohetong.fieldbyname('订货id').AsInteger;
db1.dh_update.Parameters.ParamByName('@dinghuohao').Value:=trim(labelededit1.Text);
明明有@dinghuoid这个参数的,可是报错说没有,实在找不到原因。我用的是Tadostoredproc
db1.dh_insert.close
db1.dh_insert.Parameters.ParamByName('@dinghuohao').Value:=trim(labelededit1.Text);
db1.dh_insert.Parameters.ParamByName('@tuoyunren').Value:=trim(combobox1.Text);
报错说参数@dinghuohao找不到,可是明明是有这个参数的,把前面那个close去掉就好了。我以为是这个关系
可是在下一个存储过程中
db1.dh_update.Parameters.ParamByName('@dinghuoid').Value:=db1.dinghuohetong.fieldbyname('订货id').AsInteger;
db1.dh_update.Parameters.ParamByName('@dinghuohao').Value:=trim(labelededit1.Text);
明明有@dinghuoid这个参数的,可是报错说没有,实在找不到原因。我用的是Tadostoredproc
ParamCheck 设置为False
把参数清除掉。
加入你的存储过程
ParamCheck 设置为True
为参数设Value和参数类型(很重要)
执行---
或者
直接用
Begin
call xxx('xx',1);
end;
这种无名块的形式调用