Subject Re: [IBO] Record was not located to update.
Author Artur Anjos
Hey Omar,

Did you really read the email from Svein? All of your code is easily replaced by setting the property "Generator Links" to something like:

pk_visitas=g_visitas

That's it. That's IBO. That's simple.

Artur Anjos


----- Original Message -----
From: Omar Rosa
To: IBObjects@yahoogroups.com
Sent: Thursday, November 15, 2001 3:31 PM
Subject: Re: [IBO] Record was not located to update.


HI!
Thanks for all.
I solved this problem creating a function to bring the value generator and called it in onnewrecord table´s event.

Some like this:

function TFormPlanoa.IB_Generator ( Tbl : String ; inc : integer) : LongInt;
begin;
QueryAcerta.Sql.Clear;
QueryAcerta.Sql.Add(format('select gen_id(%s,%d) val from rdb$database',[tbl,inc]));
queryAcerta.Open;
result := QueryAcerta.FieldByName('val').AsInteger;
QueryAcerta.Close;
end;
.....
procedure TFormVisita.TableVisNewRecord(DataSet: TDataSet);
begin
...
TableVis.FieldByName('pk_visitas').Value := FormPlanoa.IB_Generator ( 'g_visitas' , 1);
....

----- Original Message -----
From: Svein Erling Tysvær
To: ibobjects@yahoogroups.com
Sent: Tuesday, November 13, 2001 9:40 AM
Subject: Re: [IBO] Record was not located to update.


Hi Omar!

>Have a trigger After post to assign an PK counter.

This is your problem (I assume you mean after insert). How is IBO supposed
to know what you do on the server? Basically, you tell IBO to insert a new
record - which it does, then you change its identifier ON THE SERVER
WITHOUT TELLING IBO, before asking IBO to change the record again. It's
like moving without telling anyone where you move and expect mail and
friends to find your new location.

To do what you want to do, you have to assign the PK at the client side.
IBO-wise this is normally done by using GeneratorLinks (I use the native
components and don't know how GeneratorLinks is used with the TDataset
components you seem to be using).

HTH,
Set

Yahoo! Groups Sponsor



___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



[Non-text portions of this message have been removed]


Yahoo! Groups Sponsor



___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !

Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



[Non-text portions of this message have been removed]