Subject RE: [IBO] Using Params
Author Dion Oliphant
I think that all of these problems will be sorted out if I can figure out
how to use the EditSQL property at runtime - how do you open up a dataset
which has an update SQL property set and to which you have passed params.
How do you effect these updates? Open the dataset?

Thanks,
Dion.


-----Original Message-----
From: Dion Oliphant [mailto:dion@...]
Sent: 08 January 2001 02:41
To: IBObjects@egroups.com
Subject: RE: [IBO] Using Params


Stuart, I neglected to include thisin the code:-

procedure TPupilForm.tvGradeTreeEdited(Sender: TObject; Node: TTreeNode;
var S: String);
begin
with dmPupil do
begin

qryGrades.Open;
qryGrades.Prepare; [ I do PREPARE ]

if not trnGrades.InTransaction then trnGrades.StartTransaction;

try
try

Sorry for not including the piece of code.
Any other ideas!

Dion.

-----Original Message-----
From: Stuart Hunt [mailto:stuart.hunt@...]
Sent: 08 January 2001 02:02
To: 'IBObjects@egroups.com'
Subject: RE: [IBO] Using Params


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.
>
>
>