D
dbuchanan
Hello,
~ Bart, are you there?
I added an expression column to the dataset to display the value in a
related lookup table.
However when events on my form would normally update the dataset I
receive the following error;
------------------
Exception Message:
Cannot change ReadOnly property for the expression column.
------------------
Therefore I added code to remove the expression column before the
update and then recreate the expression column after the update;
\\
'Remove expression column
_dataset1.Tables("tbl010Job").Columns.Remove("SysVoltage")
_bmb.EndCurrentEdit()
Call UpdateSource1()
'Restore expression column
'Add column(s) to the dataset to display a field from the
relation
_dataset1.Tables("tbl010Job").Columns.Add("SysVoltage",
GetType(String), "Parent(FK_tbl010Job_lkp104Voltage).Voltage")
//
This does not resolve the problem I get the following error;
----------------------------------------------
An unhandled exception of type 'System.Data.DuplicateNameException'
occurred in system.data.dll
Additional information: A column named 'SysVoltage' already belongs to
this DataTable.
-----------------------------------------------
So removing an expression column does NOT remove it! What is the
solution to this dilemma? How do I get around this problem?
dbuchanan
Bart said:There is however a bug with Updating DataTables that have expression
column(s), you need to remove the expression columns before and re-insert
them after a da.Update.
~ Bart, are you there?
I added an expression column to the dataset to display the value in a
related lookup table.
However when events on my form would normally update the dataset I
receive the following error;
------------------
Exception Message:
Cannot change ReadOnly property for the expression column.
------------------
Therefore I added code to remove the expression column before the
update and then recreate the expression column after the update;
\\
'Remove expression column
_dataset1.Tables("tbl010Job").Columns.Remove("SysVoltage")
_bmb.EndCurrentEdit()
Call UpdateSource1()
'Restore expression column
'Add column(s) to the dataset to display a field from the
relation
_dataset1.Tables("tbl010Job").Columns.Add("SysVoltage",
GetType(String), "Parent(FK_tbl010Job_lkp104Voltage).Voltage")
//
This does not resolve the problem I get the following error;
----------------------------------------------
An unhandled exception of type 'System.Data.DuplicateNameException'
occurred in system.data.dll
Additional information: A column named 'SysVoltage' already belongs to
this DataTable.
-----------------------------------------------
So removing an expression column does NOT remove it! What is the
solution to this dilemma? How do I get around this problem?
dbuchanan