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

kinglds kinglds 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
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;
...全文
评论 4
收藏 已收藏
分享
返回顶部
kinglds
Delphi 5,944 成员 262,941 内容