tags:

views:

213

answers:

2

So lets say I have a dataset based on:

SELECT     TopicLink.*, Topic.Name AS FromTopicName, Topic_1.Name AS ToTopicName
FROM         TopicLink INNER JOIN
                      Topic ON TopicLink.FromTopicId = Topic.TopicId INNER JOIN
                      Topic AS Topic_1 ON TopicLink.ToTopicId = Topic_1.TopicId

With old school ADO, using a Recordset, I could modify columns in table TopicLink and the invoke Save() on the recordset and it would make it back into the database. Is this functionality in no way possible anymore in ADO.Net, presumably with a CommandBuilder? Or is there a workaround?

(Yes I know I could "simply" write a stored procedure...but I am looking for a quick and easy solution, basically the equivalent functionality we had in old ADO, or MS Access, where you can do a query with multiple joins, bind it to a grid on a form, and the user can update and save data, with no code required whatsoever)

Key point here: I do not want to manually write the INSERT, UPDATE, and DELETE statements.

+1  A: 

I think you can achive this by providing your own update command for the ADO.net DataAdaptor. Check out the sample provided here.

Vijesh VP
A: 

It's my understanding that as long as you've selected the entire primary key from every table you'll be updating, you should be fine, since ADO.NET will know what to do with the updated data automatically. If your returned data doesn't have the primary keys in it, though, ADO.NET won't know which rows in the tables it needs to update, and so will be unable to help you unless you specify you own UPDATE statement (as the other answerer suggested).

rwmnau