L
linghu
Unregistered / Unconfirmed
GUEST, unregistred user!
我在数据库服务器上写了一个存储过程
create procedure a @value1 int, @value2 int,@value3 int
as
insert into test values(@value1,@value2,@value3)
然后在DELPHI 中写程序调用这个过程.
在delphi中我使用的是DBEXPRESS中的存储过程组件
SP 是存储过程组件
sp.Close;
sp.Params.Clear;
sp.StoredProcName:='a';//在服务器上的过程名就是a
sp.Params.CreateParam(ftinteger,'@test1',ptinput);
sp.Params.CreateParam(ftinteger,'@test2',ptinput);
sp.Params.CreateParam(ftinteger,'@test3',ptinput);
sp.Params.ParamByName('@test1').Value:=strtoint(t1.Text);
sp.Params.ParamByName('@test2').Value:=strtoint(t2.Text);
sp.Params.ParamByName('@test3').Value:=strtoint(t3.Text);
try
sp.ExecProc;
except
begin
Application.MessageBox('执行存储过程失败!','错误信息',MB_OK+MB_ICONERROR);
exit;
end;
sp.Prepared:=true;
sp.ExecProc();
end;
在一个CLICK的事件中写的.
老提示一个出错的信息
"list index out of bound(0)"
不知道怎么回事,想请教一下.谢谢.
zk
06.10.26
create procedure a @value1 int, @value2 int,@value3 int
as
insert into test values(@value1,@value2,@value3)
然后在DELPHI 中写程序调用这个过程.
在delphi中我使用的是DBEXPRESS中的存储过程组件
SP 是存储过程组件
sp.Close;
sp.Params.Clear;
sp.StoredProcName:='a';//在服务器上的过程名就是a
sp.Params.CreateParam(ftinteger,'@test1',ptinput);
sp.Params.CreateParam(ftinteger,'@test2',ptinput);
sp.Params.CreateParam(ftinteger,'@test3',ptinput);
sp.Params.ParamByName('@test1').Value:=strtoint(t1.Text);
sp.Params.ParamByName('@test2').Value:=strtoint(t2.Text);
sp.Params.ParamByName('@test3').Value:=strtoint(t3.Text);
try
sp.ExecProc;
except
begin
Application.MessageBox('执行存储过程失败!','错误信息',MB_OK+MB_ICONERROR);
exit;
end;
sp.Prepared:=true;
sp.ExecProc();
end;
在一个CLICK的事件中写的.
老提示一个出错的信息
"list index out of bound(0)"
不知道怎么回事,想请教一下.谢谢.
zk
06.10.26