Subject | RE: [IBO] Using Params |
---|---|
Author | Svein Erling Tysvær |
Post date | 2001-01-09T07:54:55Z |
Dion,
if you've followed Helen's advice:
your code to use FieldByName rather than ParamByName.
BTW: I'm puzzled by
if not Prepared then Prepare;
HTH,
Set
At 03:31 09.01.2001 +0200, you wrote:
if you've followed Helen's advice:
>You need a TIB_query with SQLand deleted your EditSQL, you no longer have any parameters. Simply change
>SELECT * FROM GRADES /* but for preference use the query editor and a
>proper field list */
>If GradeRef is the primary key, set the Keylinks property to GRADEREF.
>
>Set RequestLive to True.
your code to use FieldByName rather than ParamByName.
BTW: I'm puzzled by
> if Prepared then UnPrepare;An unprepare will close your entire dataset. I think you're better off with
if not Prepared then Prepare;
HTH,
Set
At 03:31 09.01.2001 +0200, you wrote:
>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
>
>
>
>
>
>
>
>
>
>