Type preparing the query before you set the parameter.
Regards,
Dennis.
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 30 May 2001 14:16
> To: Multiple recipients of list delphi
> Subject: Re: [DUG]: SQL and Parameters
>
>
> Thanks for the response Craig.
>
> When I set the SaveDate parameter specifically (as below) and then do the
> SaveToFile immediately before the SQL code is executed, the code
> written out
> still has the ":SaveDate" parameter - rather than the '01/03/2001'.
> Is this right? or should the parameter have been substituted, in the file
> that is written?
>
> procedure RunPQuery(SQLFile: string);
> begin
> with RSQuery do
> begin
> Close;
> Unprepare;
> SQL.LoadFromFile(HomeDir + '\SQLFiles\' + SQLFile + '.SQL');
> ParamByName('SaveDate').AsString := '01/03/2001';
> Prepare;
> SQL.SaveToFile('ResultSQLFile.txt');
> ExecSQL;
> MainForm.Memo.Lines.Add('Done');
> end;
> end;
>
> ----- Original Message -----
> From: "Craig Goodall" <[EMAIL PROTECTED]>
> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
> Sent: Wednesday, May 30, 2001 1:14 PM
> Subject: Re: [DUG]: SQL and Parameters
>
>
> > Hi Mark,
> >
> > Could it be a problem in the settings of the Params property?
> > For a date I use
> > Datatype ftDate
> > ParamType ptInput
> > Maybe try putting a date into the Params Value property (it can stay
> > there forever as you are always overwriting it) and see what happens?
> > I've also used things like
> > qryMyQuery.SQL.SaveToFile('MyQuerySQL.txt'); // debug only
> > to view the actual query after I've modified lines. I generally do this
> > before setting params, but you could try it afterwards.
> >
> > HTH,
> > Craig
> >
> >
> > Mark Howard wrote:
> >
> > > Okay - Too vague? Further to my post below: The error is and
> > > EDBEngineError "Could not find object' and it occurs on the line that
> > > opens the query. Is there any way to get more specific information
> > > about the error? What sort of things would cause an error of this
> > > nature? Any help would be greatly appreciated. TIA Mark
> > >
> > > Hi Using Paradox. When I run the following SQL code
> > > (DocNos.Sql) using the LoadFromFile method, things work
> > > fine; Delete from DocketNos
> > > Where DocketNo in (
> > > Select DocketNo from Dockets
> > > Where ForCode not in (
> > > Select distinct forcode from dockets
> > > where docketdate > '03/31/2001')) But when I try to
> > > parameterise it as follows, and with the final line of the
> > > Sql file changed to : where docketdate > :SaveDate)) then I
> > > get an error message "Could not find object" procedure
> > > RunPQuery(SQLFile: string);
> > > begin
> > > with RSQuery do
> > > begin
> > > Close;
> > > Unprepare;
> > > SQL.LoadFromFile('DocNos.SQL');
> > > ParamByName('SaveDate').AsString :=
> > > DateToStr(CurrentDate);
> > > Prepare;
> > > Open;
> > > MainForm.Memo.Lines.Add('Done');
> > > end;
> > > end;Can any one see where I have gone wrong? TIA Mark
> > >
> >
> >
> --------------------------------------------------------------------------
> -
> > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> > Website: http://www.delphi.org.nz
> > To UnSub, send email to: [EMAIL PROTECTED]
> > with body of "unsubscribe delphi"
> >
>
> ------------------------------------------------------------------
> ---------
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"