New row in TOracleDataSet with SQL JOIN

nrsgzz

Member
Hi all.

How can I insert a new row in a dataset when it is formed by multiple tables connected with a JOIN statement?
For example I have this SQL

SQL:
SELECT t1.rowid, t1.name, t1.address, t1.age, t2.role FROM t1, t2 WHERE t1.id = t2.id

I want to be able to insert a new row in table t1 via a data aware grid (devexpress cxgrid to be precise).
However, even if I fill out the UpdatingTable property, the INSERT operation fails because the dataset tries to include columns from table t2.

Is there any way to accomplish this?
 
You can set TOracleDataSet.OracleDictionary.FieldKinds to True:

property FieldKinds: Boolean;
Automatically check which fields belong to the updating table. These fields will become data fields (FieldKind = fkData), and all other fields will become read-only InternalCalc fields (FieldKind = fkInternalCalc).
 
The solution works however I realized it is not exactly what I want. Using the previous SQL as example:

SQL:
SELECT t1.rowid, t1.name, t1.address, t1.age, t2.role FROM t1, t2 WHERE t1.id = t2.id

Using the FieldKinds property allows me to post data to the right table but it also makes the column from t2 a read-only field! This means no value can be selected and I actually need that value further on.
Is there any way around this problem?

Thank you.
 
The columns that do not belong to the UpdatingTable have become read only thus cannot be modified in the data-aware grid.
However I need to be able to select a value and pass it to the OnBeforePost() event for further manipulation
 
Back
Top