'Joined' DataTables (columns from more-than-one db table)

S

Steve Hiemstra

Hi All,

I have to display columns from multiple database tables in a grid. I have
been able to 'query' back a single DataTable using a custom SELECT (so I
have this DataTable in a DataSet). The DataSet binds to the grid fine.

The problem is in the UPDATE. I would like to the use the
DataSet.Update( ), but because I have a 'composite' table (and ADO.NET
requires a DataTable for each corresponding DataTable in the database) I
would need to 'split' my DataTable into separate DataTables (split off the
'like' columns and preserve the 'state' of the data).

I noticed the Select( ) method in DataTable. Maybe I could use that.

Using a separate custom UPDATE SQL statement for each changed row seems the
worst case...

Any ideas?

SteveH
 
G

Greg

I recommend you bring back many Datatables (only the rows you need though)
and create DataRelations on the client.
 
M

Marina

I don't think the select can give you a subset of columns - just a subset of
rows.

If you are using a SqlCommandBuilder, as long as you are updating columns
for only one of the tables, you can modify the SQL query to only select
columns from that one table. Then, the SqlCommandBuilder will be able to
build the right update statement for that one table.
 

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