Subject | Parameterized queries |
---|---|
Author | Nico Callewaert |
Post date | 2001-01-22T18:59:44Z |
Hi list,
I'm always using parameterized queries to transfer just the record of
interest to the client, to reduce network traffic and to not transfer
unnecesary records to the clients side. I just have one problem /
question. I will use an example to explain it : let's say I get 1 invoice
record from a table. My code looks like this :
AQuery1.Prepare;
AQuery1.Params [0].AsInteger := ANumber; (let's say 1234)
AQuery1.Open;
This works nice and fast, but the problem is now, if I insert a new record,
let's say the new invoiceno is 9999. After I post the record, the new
inserted data disappears from the screen, which is normal, because the
parameter for the record was InvoiceNo := 1234.
Now I solve it like this, just close the query, add the new parameter to it
and open it again, this takes some little time and the user can see it, that
something is closing and opening again. Is there a better way, or that's
the way it has to be ?
AQuery1.Close;
AQuery1.Params [0].AsInteger := TheNewNumber; (here 9999)
AQuery1.Open;
Thanks a lot...
Nico Callewaert
E-mail : nico.callewaert@...
ncw@...
I'm always using parameterized queries to transfer just the record of
interest to the client, to reduce network traffic and to not transfer
unnecesary records to the clients side. I just have one problem /
question. I will use an example to explain it : let's say I get 1 invoice
record from a table. My code looks like this :
AQuery1.Prepare;
AQuery1.Params [0].AsInteger := ANumber; (let's say 1234)
AQuery1.Open;
This works nice and fast, but the problem is now, if I insert a new record,
let's say the new invoiceno is 9999. After I post the record, the new
inserted data disappears from the screen, which is normal, because the
parameter for the record was InvoiceNo := 1234.
Now I solve it like this, just close the query, add the new parameter to it
and open it again, this takes some little time and the user can see it, that
something is closing and opening again. Is there a better way, or that's
the way it has to be ?
AQuery1.Close;
AQuery1.Params [0].AsInteger := TheNewNumber; (here 9999)
AQuery1.Open;
Thanks a lot...
Nico Callewaert
E-mail : nico.callewaert@...
ncw@...