Subject | RE: [IBO] Using Params |
---|---|
Author | Dion Oliphant |
Post date | 2001-01-09T01:31:14Z |
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
Prepare prior to this. Calling ParamByName automatically prepares the
dataset for you.
HTH,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com
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 passto
> parameters in order to update a table. I have assigned the following SQL
> EditSQL for qryGrades. I think my problem is a BDE mentality!?If you are accessing Params[n] by number then you need to explicitely call
>
> Help will be greatyly appreciated.
Prepare prior to this. Calling ParamByName automatically prepares the
dataset for you.
HTH,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com