用TADOStoredProc运行存储过程,第一次运行正常,当再次运行这个函数时就出错,提示参数过多?
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;
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;
...全文
相关推荐
delphi 执行存储过程2种方法
1.QQ:513187410 2.保证无毒 3.简单,方便,实用 4.实例可以自行改用 5.如有非法,本人无法律责任,由改动代码人负责! 6.需要更多本人作品,查找标签“朱建强” 7.请下载,杀毒后再使用!
delphi操作存储过程.
dbms:ms sql server 2000 存储过程如下: CREATE proc tstPro @age int, @theNum int output as select @theNum=count(sn) from s where sa=@age GO delphi中调用: var str:string;
DELPHI 存储过程.txt
适合新手使用delphi存储过程,它从sql创建表,到使用存储过程
Delphi与SQL Server存储过程编程详解
Delphi与SQL Server存储过程编程详解
delphi调用Oracle的存储过程
delphi如何调用Oracle的存储过程


