C
CJ
Unregistered / Unconfirmed
GUEST, unregistred user!
一个存储过程如下定义:
CREATE PROCEDURE appsp_inplotcalcul
@inplotbill_id varchar(20)
AS...
我使用了TParamenters.Add(way one)和CreateParameter(Way two)
都得到paramenter xxx not suplied错误,就和没有参数一样!后来
改用ADOQuery,问题解决(Way Three),不知道如何动态增加ADOStor-
edProc的参数?记得以前那么干过,好象成功的。
代码如下:
procedure...
var
aspTemp: TADOStoredProc;
aqTemp: TADOQuery;
begin
aspTemp := TADOStoredProc.Create(Application);
try
Screen.Cursor := crHourGlass;
with aspTemp do
begin
Connection := AConnection;
//Way one
Parameters.AddParameter;
Parameters[0].DataType := ftWideString;
Parameters[0].Direction := pdInput;
Parameters[0].Size := 20;
Parameters[0].Value := BillID;
//way Two
Parameters.CreateParameter('@inplotbill_id',ftString,pdInput,20,BillID);
Parameters[0].Value := BillID;
ProcedureName := 'appsp_inplotcalcul';
Prepared := True;
ExecProc;
end;
finally
FreeAndNil(aspTemp);
Screen.Cursor := crDefault;
end;
//Way Three
aqTemp := TADOQuery.Create(Application);
try
aqTemp.Connection := AConnection;
aqTemp.SQL.Clear;
aqTemp.SQL.Add('appsp_inplotcalcul ' + BillID);
aqTemp.ExecSQL;
finally
aqTemp.free;
end;
CREATE PROCEDURE appsp_inplotcalcul
@inplotbill_id varchar(20)
AS...
我使用了TParamenters.Add(way one)和CreateParameter(Way two)
都得到paramenter xxx not suplied错误,就和没有参数一样!后来
改用ADOQuery,问题解决(Way Three),不知道如何动态增加ADOStor-
edProc的参数?记得以前那么干过,好象成功的。
代码如下:
procedure...
var
aspTemp: TADOStoredProc;
aqTemp: TADOQuery;
begin
aspTemp := TADOStoredProc.Create(Application);
try
Screen.Cursor := crHourGlass;
with aspTemp do
begin
Connection := AConnection;
//Way one
Parameters.AddParameter;
Parameters[0].DataType := ftWideString;
Parameters[0].Direction := pdInput;
Parameters[0].Size := 20;
Parameters[0].Value := BillID;
//way Two
Parameters.CreateParameter('@inplotbill_id',ftString,pdInput,20,BillID);
Parameters[0].Value := BillID;
ProcedureName := 'appsp_inplotcalcul';
Prepared := True;
ExecProc;
end;
finally
FreeAndNil(aspTemp);
Screen.Cursor := crDefault;
end;
//Way Three
aqTemp := TADOQuery.Create(Application);
try
aqTemp.Connection := AConnection;
aqTemp.SQL.Clear;
aqTemp.SQL.Add('appsp_inplotcalcul ' + BillID);
aqTemp.ExecSQL;
finally
aqTemp.free;
end;