TOracleDataSet. Append - Error

Hallo!

I have DOA 4.0.3.
And all what I want to do is:

DS: TOracleDataSet;
DS.Session:=MySession;

DS.SQL.Text:='select * from MyTBL';
DS.ReadOnly:=false;
DS.Open();
DS.Append; { ----- ERROR ------ }
DS.FindField('....').AsString:=....;
DS.Post;

But after DS.Append see I an Error Message,
which in translating at English is:
"EDatabaseError. Dataset, which is only for reading, can not be changed"

if I make:
Q: TOracleQuery;
Q.Session:=MySession;

Q.SQL.Text:='insert into MyTBL values (......)'
Q.Execute

Than all be OK?

What must I make with TOracleDataSet?

Thank You!

Johnny.
 
To make a dataset updateable, you will need to add the rowid:

DS.SQL.Text:='select MyTBL.*, rowid from MyTBL';

Making a dataset updateable
To be able to update records, a dataset needs to know the 'rowid' of every retrieved record. A rowid is an internal Oracle structure that uniquely identifies a record in the database. As long as you do not include it in the query, the CanModify property of the dataset remains False. To make an updateable dept dataset, the SQL property would be:

select dept.*, dept.rowid from dept

Furthermore, you should not use column aliases for the updateable table in the select statement of an updateable dataset. These alias names would be used in subsequent insert or updates to the updating table, and would therefore lead to an error.

If for some reason it is not possible to supply a rowid in the query, you can use the OnApplyRecord event to make the dataset updateable.
 

Similar threads

Back
Top