Subject RE: [IBO] Using Params
Author Stuart Hunt
Dion,
before accessing any parameters in a statement you must ensure that it is
prepared. Adding the line indicated in your code should fix the problem,
HTH,
Stuart Hunt,
Senior Developer,
IdeaGen Software Limited.

> -----Original Message-----
> From: Dion Oliphant [SMTP:dion@...]
> Sent: 08 January 2001 11:40
> To: ibobjects@egroups.com
> Subject: [IBO] Using Params
>
> Hi,
>
> I keep getting an access error with the code below. I want to pass
> parameters in order to update a table. I have assigned the following SQL
> to
> EditSQL for qryGrades. I think my problem is a BDE mentality!?
>
> Help will be greatyly appreciated.
>
> if not trnGrades.InTransaction then trnGrades.StartTransaction;
>
> try
> try
>
> { The tree is being edited. Try and update the record on the
> database. }
>
[Stuart Hunt]
if not qryGrades.Prepared
then qryGrades.Prepare;
> qryGrades.Params[0].AsInteger := TNodeTypeData(Node.Data^).Ref;
> qryGrades.Params[1].AsString := S;
> qryGrades.Open;
>
> if trnGrades.InTransaction then trnGrades.Commit;
>
> except on EIB_ISCError do
>
>
> { Don't change the node value to the new value. }
> abort;
> end;
>
> finally
> qryGrades.Close;
> end;
>
> Thanks,
> Dion.
>
>
>