Henry Vuong

Henry Vuong

  • NA
  • 27
  • 0

Update database with multiple-table dataset

Jul 5 2012 11:30 PM
I have a dataset that holds the data selected from more than one table, like this:

string str = "Select table1.columnA, table1.columnB, table2.columnC from table1 left join table2 on table1.columnD = table2.columnD";


DataAdapter da = new DataAdapter(str,connection);

da.Fill(dataset, "tablename");


I want to update the changes in the dataset back to the database. I cannot use the DataAdaptor.Update method, like this:
da.Update(dataset,"tablename");

If I run the above command, I got an error like "Dynamic Sql generation is not supported against multiple base tables." How do I go about updating the changes? Note that I only need to update the changes to table1, not table2.




Answers (1)