Column Expression question

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?
 
M

Miha Markic [MVP C#]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top