Can't remove expression column!!! So I can't update data!!! Help

  • Thread starter Thread starter dbuchanan
  • Start date Start date
D

dbuchanan

Hello,

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
 
Hi,

dbuchanan said:
Hello,



~ Bart, are you there?

Yes :-)
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;

Yes that seems right. So i don't know why you have this error, i did test
this at the time i posted the message and i did a quick test now and it
worked.

The error you have seems to suggest that the expression column wasn't
removed or already been re-added, can you double check everything ? Are you
sure UpdateSource1() doesn't re-add it ?

HTH,
Greetings
 
Hi Bart,

I found the problem.

I am using multiple inherited forms which makes it a little more
difficult to track this.

Do you know if this bug that requires removing and readding expression
columns is fixed in vb2005?

Thank you,
dbuchanan
 
Hi,

dbuchanan said:
Hi Bart,

I found the problem.

I am using multiple inherited forms which makes it a little more
difficult to track this.

Yep, can imagine that.
Do you know if this bug that requires removing and readding expression
columns is fixed in vb2005?

Nope, haven't tried it yet.

Greetings
 
Back
Top