Subject Re: [IBO] Error updating TIBOTable
Author Helen Borrie
At 07:17 AM 17-04-01 +0000, you wrote:
>Helen,
>I am confused, it was my understanding that going from the standard
>Delphi TTable to the TIBOTable required practically no change in code.
>But trying to just update a record is impossible to me.
>I have a table with a key named 'NUM' I just want to open the table
>(wich will place it on the first record) change a field and post it.
>What must I do to do this ?
>Explain it to me as I was (maybe I am) a complete moron please.
>As you suggested I put a keylinks statement to tell the TIBOTable
>wich the key field is, but the result is the same.


> DM.T_Art.Close;
> DM.T_Art.KeyLinks.Clear;
> DM.T_Art.KeyLinks.Add('NUM');
> DM.T_Art.Open;
> DM.T_Art.Edit;
> DM.T_ArtMENU.AsInteger := 120;
> DM.T_Art.Post;

As the KeyLinks will not change on closing and opening the dataset, you should set KeyLinks as a property in the Object Inspector at design time. Although you haven't mentioned it, I'm assuming you set RequestLive true.

Also, check whether AutoCommit is set True in your TIBODatabase. If not, then Post does not commit the transaction.

I'm curious as to what the purpose of this operation is in your application. If all you want to do is alter one value in one column in one row, you have no need to bring a dataset across to your application at all. You can construct an executable SQL statement (known as "DML") for your query at run-time, prepare it and execute it dynamically from the client without fetching and opening a whole set of data...

Regards,
Helen

All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________