I have a query in MSAccess2K which expects 3 parameters.
In my delphi app i connect to the query using a TADOStoredProc.
when passing parameters, the following DOES NOT work:
with Orders do begin //this is the TADOStoredProc
Close;
Parameters.ParamByName('DateFrom').Value :=dpFrom.Date;
Parameters.ParamByName('DateTo').Value := dpTo.Date;
Parameters.ParamByName('aDateType').Value := cbDateTypes.Text;
Open;
end;
WHY? Using a normal TADOQuery i can pass parametersin the same fashion and it works properly. For the TADOStoredProc it works only with the 1st values passed, when called again it still shows records 4 the 1st values passed. Its as if it doesnot referesh the parameterlist
So i end up having to do it as follows:
with dbgList.DataSource.DataSet AS TADOStoredProc do begin
Close;
Parameters.Clear;
Parameters.CreateParameter('DateFrom', ftDateTime, pdInput, 0, dpFrom.Date);
Parameters.CreateParameter('DateTo', ftDateTime, pdInput, 0, dpTo.Date);
Parameters.CreateParameter('aDateType', ftString, pdInput, 13, cbDateTypes.Text);
Open;
end;
What am i missing? or is the way to do it with TADOStoredProc? (somehow i donot want to believe that thats the case!!)
TIA,
cpmasesa
In my delphi app i connect to the query using a TADOStoredProc.
when passing parameters, the following DOES NOT work:
with Orders do begin //this is the TADOStoredProc
Close;
Parameters.ParamByName('DateFrom').Value :=dpFrom.Date;
Parameters.ParamByName('DateTo').Value := dpTo.Date;
Parameters.ParamByName('aDateType').Value := cbDateTypes.Text;
Open;
end;
WHY? Using a normal TADOQuery i can pass parametersin the same fashion and it works properly. For the TADOStoredProc it works only with the 1st values passed, when called again it still shows records 4 the 1st values passed. Its as if it doesnot referesh the parameterlist
So i end up having to do it as follows:
with dbgList.DataSource.DataSet AS TADOStoredProc do begin
Close;
Parameters.Clear;
Parameters.CreateParameter('DateFrom', ftDateTime, pdInput, 0, dpFrom.Date);
Parameters.CreateParameter('DateTo', ftDateTime, pdInput, 0, dpTo.Date);
Parameters.CreateParameter('aDateType', ftString, pdInput, 13, cbDateTypes.Text);
Open;
end;
What am i missing? or is the way to do it with TADOStoredProc? (somehow i donot want to believe that thats the case!!)
TIA,
cpmasesa