用TADOStoredProc运行存储过程,第一次运行正常,当再次运行这个函数时就出错,提示参数过多?

kinglds 2004-03-05 09:31:27
function TfrmLogin.AddLinkServer: boolean;
var
ReVal: integer;
begin
result := true;
with astpUpdate do//调用存储过程
begin
try
self.cursor:=crHourGlass;
Active := false;
ProcedureName := 'UpdAddLinkServer';
CommandTimeout := aConnLocal.CommandCount;
with Parameters.AddParameter do
begin
Name := '@StrHost';
Datatype := ftString ;
Direction := pdInput;
Value := Trim(edtRemoteHost.Text);
end;
with Parameters.AddParameter do
begin
Name := '@StrAccount';
Datatype := ftString;
Direction := pdInput;
Value := Trim(edtRemoteAccount.Text);
end;
with Parameters.AddParameter do
begin
Name := '@StrPass';
Datatype := ftString;
Direction := pdInput;
Value := Trim(edtRemotePass.Text);
end;
with Parameters.AddParameter do
begin
Name := '@ReVal';
Datatype := ftInteger;
Direction := pdInputOutput;
end;

lblState.Caption := '正在建立远程数据库连接!';
lblState.Visible := true;
Prepared := true;
ExecProc;
ReVal := Parameters.ParamByName('@ReVal').Value;
//这是这一行,提示参数过多

IF ReVal = 1 then
begin
lblState.Caption := '已经建立与远程数据库连接!';
close;
end
else
BEGIN
lblState.Caption := '建立远程数据库连接失败,请检查输入的信息!';
self.Cursor := crDefault;
MessageDlg('建立远程数据库连接失败,请检查输入的信息!',mtWarning,[mbOk],0);
close;
result := false;
END;
self.Cursor := crDefault;

except
lblState.Caption := '建立远程数据库连接失败,请检查输入的信息!';
self.Cursor := crDefault;
MessageDlg('建立远程数据库连接失败,请检查输入的信息!',mtWarning,[mbOk],0);
close;
end;//try
end;//存储过程
end;
...全文
70 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复

5,386

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧