Expression columns in strongly typed datasets

B

Brian Smith

I have a typed DataSet populated from a SQL query. To the columns
returned by the query I have added a calculated column with an
expression of the form Quantity * UnitPrice, but after filling the
DataSet with a DataAdapter the expression column remains at the default
value of zero regardless of the Quantity and UnitPrice values.

These records are edited in a DataGrid, so I can't always rely on the
SQL query to perform the calculation. Is there some trick to getting
expressions to work?
All the examples I've seen appear to add the expression column to an
(untyped) dataset after loading the data. This isn't possible with a
typed DataSet....HELP!

brian smith
 
B

Brian Smith

Some progress on this. The problem does not occur if I populate the
typed dataset directly in the DataAdapter Fill. Trouble is, I'm using
the Microsoft Data Access Block (SQLHelper) which only has generic
methods for DataSet, so I Merge into my typed DS, which clearly causes
the problem. I've either got to duplicate a lot of generic code for each
typed DataSet, or perhaps it works if I add the expression columns to
the generic DataSet before I Merge.....

Any thoughts on the best solution would help...

brian
 

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