Column Expression question

  • Thread starter Thread starter Mika M
  • Start date Start date
M

Mika M

Hello!

After filling table into DataSet (ds), I added following line ...

ds.Tables(0).Columns("MyColumn").Expression = "<MyFormula>"

.... and calculation is working fine - but I need to save this calculated
field value into database also because it makes easier to make SELECT
queries later and it's quite often needed value in many cases too. This
"MyColumn" is as a field in database too, and is used too when making
DataAdapter in SELECT-query.

When trying to save, I'll get error message ...

"The column mapping from SourceColumn 'MyColumn' failed because the
DataColumn 'MyColumn' is a computed column."

Is it possible to save computed column values into database table at all?
 
Hi,

One solution would be to add a column to table (before saving) and copy
computed values to it.
Then use that column to store data.
The other way would be not to use expressions at all - rather compute it by
yourself.
 
Back
Top