Problem with ADO Stored Proc and Parameters
We get an error when assigning values to our parameters of a Stored
Procedure. It says the first Parameter can not be found. It is perfect as in
the Stored procedure and it is assigned a valid value.
Does the standard rule of Opening and Closing a Stored procedure when using
a SELECT statement and also just using ExecProc when using an INSERT or
UPDATE statement apply in ADO? Is it required to set Active False and then
true rather.
Please shed some light for us on this because we are desperate in our effort
of converting to ADO Stored procedures from Std TADOQuery components because
all the rules we used before seems to have changed.
Here is the Stored Proc
Alter Procedure spILoad1
@pID varchar(10),
@pLOADTYPEID int,
@pLOADDATE datetime,
@pORIGINID varchar(10),
@pDESTID varchar(10),
@pCARRIERID varchar(10)
As
INSERT INTO LOADS (ID, LOADTYPEID, LOADDATE, ORIGINID, DESTID, CARRIERID)
VALUES (@pID, @pLOADTYPEID, @pLOADDATE,
@pORIGINID, @pDESTID, @pCARRIERID)
return
and the code where we call it
// dmData.spILoad1.Active := false; ???????????? is this required?
dmData.spILoad1.Parameters.ParamByName('@pID').Value := ID;
dmData.spILoad1.Parameters.ParamByName('@pLOADTYPEID').Value :=
dmData.tLocal['LOADTYPEID'];
dmData.spILoad1.Parameters.ParamByName('@pLOADDATE').Value := now;
dmData.spILoad1.Parameters.ParamByName('@pORIGINID').Value := 'NIS';
dmData.spILoad1.Parameters.ParamByName('@pDESTID').Value :=
trim(Edit15.Text);
dmData.spILoad1.Parameters.ParamByName('@pCARRIERID').Value :=
trim(DBLookupComboBox4.KeyValue);
dmData.spILoad1.ExecProc;