Column Expression question  
Author Message
AnthonyD





PostPosted: Fri Feb 20 04:50:22 CST 2004 Top

ADO >> Column Expression question 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

DotNet441  
 
 
Miha





PostPosted: Fri Feb 20 04:50:22 CST 2004 Top

ADO >> Column Expression question 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" <EMail@HideDomain.com> wrote in message
news:%EMail@HideDomain.com...
> 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
>
>