Subject Re: [IBO] Insert problem/question upgrading from v4.8
Author Geoff Worboys
'Michael Horne' guardian_yahoo@... [IBObjects] wrote:
> Hello,
>
> I am upgrading a program from delphi7, ibo v4.8 to the newest
> ibo v5.5.5.
>
> I have come across a section of code where a query contains
>
> SELECT *
> FROM ORDERSM
> WHERE OM_ID = :ID
>
> the Delphi code does the following
>
> qyOrdersM.Insert;
> xOM_ID := qyOrdersM.FieldByName('OM_ID').AsInteger;
> qyOrdersM.FieldByName('OM_CONSOLIDATED_ID').AsInteger:=xOM_ID;
> qyOrdersM.FieldByName('OM_CUS_ID').AsInteger := xKeyCustomer;
> qyOrdersM.Post;
>
> qyOrdersM.Edit;
>
> the edit is causing an exception of
> "Cannot Edit current Row"
>
> I know that the code was working before the upgrade of IBO.
>
> -------------------------------------
> I can fix this by inserting the following 3 lines before the "Edit"
> qyOrdersM.Close;
> qyOrdersM.ParamByName('ID').AsInteger := xOM_ID;
> qyOrdersM.Open;
>
>
> But is this the best way to handle it?

Hi Michael,

There's not really enough context to give a definite answer
as to what's best. My first instinct is to suggest that
TIB_Query is not ideal for the technique you are using, but
really it's a matter of what else you're doing with it.

Essentially, with the SQL as given, at some point the required
parameter must be assigned so that the query will actually be
able find the row.

> Are there any other problems I am likely to run into while
> doing the conversion?

Having only recently migrated a large project from IBO v4.8
to IBO v5.5, I am tempted to say "lots!". :-)

However many of the problems I experienced were due to the
quite heavy customisations I have in the IBO code, and the
interesting things I do with deriving new components from
IBO components.

What you have to look forward to is going to depend a lot on
your specific application.

Having made the move from IBO 4 to 5, I am now trying to make
the move from Delphi 6 to XE7 ... and that's proving to be
entertaining.

--
Geoff Worboys
Telesis Computing Pty Ltd