Expression column in typed dataset

E

Emma Burrows

I have a typed dataset which imports a table from an Access database. In the
VS 2005 designer, I have added a column to this table (imaginatively
entitled Column1), and entered an expression using the Properties dialog.
When I run any of the queries in the TableAdapter while I'm still in the
designer, Column1 appears, with the result of the expression as expected.

However, when I try to use Column1 in my actual code, its value is always
the default value. It feels as though there's something else I'm supposed to
do, but Google has returned nothing - just examples of how you add a column
like this in the designer and, hey presto, it works (except in my case, it
doesn't). So suggestions are welcome...

(Actually, I was hoping to sort the table based on the computed column, so
if there are any better suggestions for that, they'd be welcome too)
 
E

Emma Burrows

Emma Burrows said:
I have a typed dataset which imports a table from an Access database. In the
VS 2005 designer, I have added a column to this table (imaginatively
entitled Column1), and entered an expression using the Properties dialog.

However, when I try to use Column1 in my actual code, its value is always
the default value.

For future reference if anyone else comes across this problem and has as
much trouble finding out why it's happening... I've found the answer to my
question - it seems this is by design, and a rather clunky workaround is
given at the following location:

http://forums.asp.net/thread/1167728.aspx

However, it is possible to create expression columns using SQL statements in
the table adapter queries, so that's the route I've taken (though Access,
the ODBC driver and VS2005 all have different ideas about what SQL keywords
should be supported, so it's been a lot of trial and error!).
 

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