RefreshMode = Both does not work
RefreshMode = Both does not work
Situation:
Typed dataset. Master-Detail.
Master:
dataset1.table1 is master. SQL Text : select a.aa from a
In the Grid1 dataset1.table1 is shown.
Detail:
Detail dataset1.table2 is detail. SQL Text : select b.bb, b.bb as bb2, a.aa from a, b where a.aID = b.aID
dataset1.table2.RefreshMode = RefreshRowMode.Both;
dataset1.table2.RefreshingFields = "aa, bb";
In the Grid2 dataset1.table2 is shown. Grid2 has two columns:
- column 1 shows bb column.
- column 2 shows aa column
I also have control binded to bb2 column.
I do:
I add new record to dataset1.table2. Set bb2 column value and save (dataset1.table2.Update()).
I see in the grid that new record has been added, but both columns are empty.
Question: Why autorefresh does not work? Why fields values are not retrieveed from the server after an UPDATE statement execution.
________
HEADSHOP
Typed dataset. Master-Detail.
Master:
dataset1.table1 is master. SQL Text : select a.aa from a
In the Grid1 dataset1.table1 is shown.
Detail:
Detail dataset1.table2 is detail. SQL Text : select b.bb, b.bb as bb2, a.aa from a, b where a.aID = b.aID
dataset1.table2.RefreshMode = RefreshRowMode.Both;
dataset1.table2.RefreshingFields = "aa, bb";
In the Grid2 dataset1.table2 is shown. Grid2 has two columns:
- column 1 shows bb column.
- column 2 shows aa column
I also have control binded to bb2 column.
I do:
I add new record to dataset1.table2. Set bb2 column value and save (dataset1.table2.Update()).
I see in the grid that new record has been added, but both columns are empty.
Question: Why autorefresh does not work? Why fields values are not retrieveed from the server after an UPDATE statement execution.
________
HEADSHOP
Last edited by Tatyana on Thu 24 Feb 2011 22:45, edited 4 times in total.
more information
Grid is DevExpress.XtraGrid
I use ver 5.0.22
I tried in ver 5.20.29 - the same bug =(
DBMonitor shows only "insert" call. no select call.
only if I scroll in Master - I see Grid 2 Column Values
Please help, may be I miss some kind of property that should be set?
________
XL7
I use ver 5.0.22
I tried in ver 5.20.29 - the same bug =(
DBMonitor shows only "insert" call. no select call.
only if I scroll in Master - I see Grid 2 Column Values
Please help, may be I miss some kind of property that should be set?
________
XL7
Last edited by Tatyana on Thu 24 Feb 2011 22:46, edited 2 times in total.
Sorry, this is not a bug. When you create Devart Typed DataSet, TableAdapter's insert and update commands are generated in our DataSet Wizard. So, it is not enough to set the RefreshMode and RefreshingFields properties if the update commands are generated already. Please use the following code:
The update commands will be regenerated automatically with the RETURNING clause, and the values will be retrieved from the server after an UPDATE statement execution.
Please notify us about the results.
Code: Select all
dataset1.table2.InsertCommand = null;
dataset1.table2.UpdateCommand = null;
dataset1.table2.RefreshMode = RefreshRowMode.Both;
dataset1.table2.RefreshingFields = "aa, bb";
Please notify us about the results.
Your suggestion does not work:
{System.InvalidOperationException: Dynamic SQL generation is not supported against multiple base tables.
at System.Data.Common.DbDataAdapter.UpdatingRowStatusErrors(RowUpdatingEventArgs rowUpdatedEvent, DataRow dataRow)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)
at Devart.Common.DbDataTable.Update()
at Devart.Data.Oracle.OracleDataTable.Update()
at Centric.CommonLib.DBBindingHandler.PostDataSource() in C:\src\PCM\Projects\Centric\MVV4all.NET\CommonLib\DBButtons.cs:line 185}
________
GRIEF OR LOSS ADVICE
{System.InvalidOperationException: Dynamic SQL generation is not supported against multiple base tables.
at System.Data.Common.DbDataAdapter.UpdatingRowStatusErrors(RowUpdatingEventArgs rowUpdatedEvent, DataRow dataRow)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)
at Devart.Common.DbDataTable.Update()
at Devart.Data.Oracle.OracleDataTable.Update()
at Centric.CommonLib.DBBindingHandler.PostDataSource() in C:\src\PCM\Projects\Centric\MVV4all.NET\CommonLib\DBButtons.cs:line 185}
________
GRIEF OR LOSS ADVICE
Last edited by Tatyana on Thu 24 Feb 2011 22:46, edited 1 time in total.
It is not comfortable and not usefull, besides Odac Delphi components handle it wihtout any problem.
Please recommend how can I update columns which belong to onother table, not the one which columns are being updated from UI.
________
Maine Dispensary
Please recommend how can I update columns which belong to onother table, not the one which columns are being updated from UI.
________
Maine Dispensary
Last edited by Tatyana on Thu 24 Feb 2011 22:46, edited 1 time in total.
We recommend you to create the update command manually. For example, OracleDataTable with the "select b.bb, b.bb as bb2, a.aa from a, b where a.aID = b.aID" select command should have the following update command:
UPDATE SCOTT.B SET BB = :BB WHERE (((:IsNull_BB = 1 AND BB IS NULL) OR (BB = :Original_BB))) RETURNING BB, BB INTO :BB, :BB2
Please note, :BB and :BB2 should have the InputOutput direction.
UPDATE SCOTT.B SET BB = :BB WHERE (((:IsNull_BB = 1 AND BB IS NULL) OR (BB = :Original_BB))) RETURNING BB, BB INTO :BB, :BB2
Please note, :BB and :BB2 should have the InputOutput direction.
I didn't help:Shalex wrote:This works for one table only. If your select contains several tables, you can choose one table you are interested in by setting the UpdatingTable property to the name of that only table. Other tables from the select command will not be updated.
dataset1.table2.InsertCommand = null;
dataset1.table2.UpdateCommand = null;
dataset1.table2.RefreshMode = RefreshRowMode.Both;
dataset1.table2.UpdatingTable = "b"; //update table b
// Using this:
dataset1.table2.RefreshingFields = "aa, bb";
// I get error ORA-00926: missing VALUES keyword
//dataset1.table2.InsertCommand is null
//Using this: asking for updating only column of the b table
dataset1.table2.RefreshingFields = "bb";
// I get error:
//ORA-06550: line 1, column 35:
//PL/SQL: ORA-00926: missing VALUES keyword
//ORA-06550: line 1, column 7:
//PL/SQL: SQL Statement ignored
//dataset1.table2.InsertCommand is null
________
Jaguar aj-v6 engine history
Last edited by Tatyana on Thu 24 Feb 2011 22:47, edited 1 time in total.