Subject | RE: [IBO] IBO Guide - Using Params |
---|---|
Author | Helen Borrie |
Post date | 2001-01-09T10:40:16Z |
At 12:24 PM 09-01-01 +0200, you wrote:
your EditSQL and just go with the standard IBO technique.
Now you are talking about searched updates, it's starting to get awfully
confused. EditSQL won't work for searched updates, only for the selected
row. If we are now moving on to a different topic, please state it.
FWIW, the reason you get an access viol is because you are trying to refer
to params that don't exist. The reason they don't exist is that you didn't
call Prepare first (this is what Jason was trying to tell you.)
Using the Params[] array instead of ParamByName is not a great idea, IMO,
because when SPs with output params get involved, you can get some
unexpected errors by referring to the params indices. With ParamByName,
there is no risk AND the Prepare will be done for you if it is needed.
The Params[] array was only ever there for cases where you needed to
iterate through parameters. This isn't ever going to be the case when
using conventional IBO techniques...it might be useful for a custom handler
sometime when you want to feed e.g. the RowData array into Params (but stay
away from that until you get the basics worked out !! :)))
So, if you INSIST on using the Params[] array:
With MyQuery do
begin
if not Prepared then Prepare;
Params[0].AsString := Something;
Params[1].AsString := SomethingElse;
Open;
end;
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________
>Using the IBO guide I can't figure out if I can use a TIB_Query to hold aYes, as I showed you in my posting yesterday. I gave you the code. Delete
>set of data and when I need to explicitly update a record(Searched - ie not
>necessarily the current record) can I just pass it the update
>params??????????(From the EditSQL) I don't want to reposition the cursor in
>this case
your EditSQL and just go with the standard IBO technique.
Now you are talking about searched updates, it's starting to get awfully
confused. EditSQL won't work for searched updates, only for the selected
row. If we are now moving on to a different topic, please state it.
FWIW, the reason you get an access viol is because you are trying to refer
to params that don't exist. The reason they don't exist is that you didn't
call Prepare first (this is what Jason was trying to tell you.)
Using the Params[] array instead of ParamByName is not a great idea, IMO,
because when SPs with output params get involved, you can get some
unexpected errors by referring to the params indices. With ParamByName,
there is no risk AND the Prepare will be done for you if it is needed.
The Params[] array was only ever there for cases where you needed to
iterate through parameters. This isn't ever going to be the case when
using conventional IBO techniques...it might be useful for a custom handler
sometime when you want to feed e.g. the RowData array into Params (but stay
away from that until you get the basics worked out !! :)))
So, if you INSIST on using the Params[] array:
With MyQuery do
begin
if not Prepared then Prepare;
Params[0].AsString := Something;
Params[1].AsString := SomethingElse;
Open;
end;
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________