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?

--
Thanks in advance!

Mika

Re: Column Expression question by Miha

Miha
Fri Feb 20 04:50:22 CST 2004

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.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"Mika M" <mika.mahonen@nospam_kolumbus.fi> wrote in message
news:%23YXrQq59DHA.548@TK2MSFTNGP11.phx.gbl...
> 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?
>
> --
> Thanks in advance!
>
> Mika
>
>