Hello there,
First of all, I'm using DOA components 4.0.7.1 in combination with delphi 7.
In my application I have a TDBGrid into which I want to load the resulting ref cursor data from a call to a stored procedure in an oracle database.
This all works well, I call the procedure using a TOracleQuery with a complex variable of type otCursor assigned to another TOracleQuery instance as it is described in the help files.
Now I assign this cursor TOracleQuery instance to a TOracleDataset's ExternalCursor property and assign this Dataset to my grid.
Now the problem comes up if I try to edit values in the grid, because nothing happens. The grid & dataset are set to readonly := false and the edit mode in the grid is enabled. I suppose I need to give some update sql code to the dataset in order to make it work, but I don't know how.
On some other source, I found out that I have to add selection of the rowID, which I did in the stored procedure which returns the ref cursor. Now after this change, when I try to edit values in the grid, the application crashes with an EOracleError "Table 1 does not exist". So I found I have to set the UpdatingTable property of the Dataset which I did. On the next try to edit a value, I got EOracleError "Field 1 does not exist".
Now I'm pretty much stuck at this point, as I have no clue what else I need to do.
Is my approach all wrong or am I just missing anything ? Is there any link to an example to make this work ?
Thanks...
Here the interesting part of the code :
First of all, I'm using DOA components 4.0.7.1 in combination with delphi 7.
In my application I have a TDBGrid into which I want to load the resulting ref cursor data from a call to a stored procedure in an oracle database.
This all works well, I call the procedure using a TOracleQuery with a complex variable of type otCursor assigned to another TOracleQuery instance as it is described in the help files.
Now I assign this cursor TOracleQuery instance to a TOracleDataset's ExternalCursor property and assign this Dataset to my grid.
Now the problem comes up if I try to edit values in the grid, because nothing happens. The grid & dataset are set to readonly := false and the edit mode in the grid is enabled. I suppose I need to give some update sql code to the dataset in order to make it work, but I don't know how.
On some other source, I found out that I have to add selection of the rowID, which I did in the stored procedure which returns the ref cursor. Now after this change, when I try to edit values in the grid, the application crashes with an EOracleError "Table 1 does not exist". So I found I have to set the UpdatingTable property of the Dataset which I did. On the next try to edit a value, I got EOracleError "Field 1 does not exist".
Now I'm pretty much stuck at this point, as I have no clue what else I need to do.
Is my approach all wrong or am I just missing anything ? Is there any link to an example to make this work ?
Thanks...
Here the interesting part of the code :
Code:
mDSDCIDs := TOracleDataset.Create(self);
mDSDCIDs.ExternalCursor := CursorQuery;
mDSDCIDs.UpdatingTable := 'tbl_dcids';
//what else here to avoid "field 1 does not exist" ?
mDSDCIDs.Session := mSession;
mDSDCIDs.Active := true;
mDataSource.DataSet := mDSDCIDs;
mGridDCIDs.Datasource := mDataSource;
Last edited: