Subject AW: [IBO] Using Params
Author Christian Kaas
Hi Dion,

as far as a know a Query HAS TO BE prepared for the params to be set!?
What sense does it make to unprepare the query - the normal work order
is:
-----------------------
Prepare;

Set Params;
ExecuteQuery or Open;
Loop or whatever...

Unprepare;
-----------------------

> "640kb should be enough memory for everyone"
> Bill Gates 1984
>
> Christian Kaas Software development
> www.kaas-labs.de

> -----Ursprungliche Nachricht-----
> Von: Dion Oliphant [mailto:dion@...]
> Gesendet: Dienstag, 9. Januar 2001 02:31
> An: IBObjects@egroups.com
> Betreff: RE: [IBO] Using Params
>
>
> Hi Jason,
>
> The following piece of code causes the error "unknown Param
'GradeRef'"
>
> with dmPupil, dmPupil.qryGrades do
> begin
>
> if not trnGrades.InTransaction then trnGrades.StartTransaction;
>
> try
> try
> if Prepared then UnPrepare;
>
> { The tree is being edited. Try and update the record in the
> database. }
> ParamByName('GradeRef').AsString :=
> inttostr(TNodeTypeData(Node.Data^).Ref);
> ParamByName('GradeName').AsString := S;
> Prepare;
> Open;
>
> if trnGrades.InTransaction then trnGrades.Commit;
>
> except on e:EIB_ISCError do
> { Don't change the node value to the new value. }
> abort;
> end;
> ...
> ...
>
> UpdateSQL is
> UPDATE Grades
> SET GradeName = :GradeName
> WHERE GradeRef = :GradeRef
>
> RequestLive = true
> KeyLinks :-
> GRADES.GRADEREF (which is the primary key for this table)
>
> Comment:- surely the EditSQL params(?) must be set and not
> qryGrades.SQL(which has no params)
> SELECT GRADEREF
> , GRADENAME
> FROM GRADES
>
>
> -----Original Message-----
> From: Jason Wharton [mailto:jwharton@...]
> Sent: 09 January 2001 12:11
> To: IBObjects@egroups.com
> Subject: Re: [IBO] Using Params
>
>
> > 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 you are accessing Params[n] by number then you need to explicitely
call
> Prepare prior to this. Calling ParamByName automatically prepares the
> dataset for you.
>
> HTH,
> Jason Wharton
> CPS - Mesa AZ
> http://www.ibobjects.com
>
>
>
>
>
>
>
>
>