How to write back to two table with GridView

  • Thread starter Thread starter ad
  • Start date Start date
A

ad

I use GridView to edit the columns form two table.
The select command is select data from to table like:
Select A.StudentName, A.Weight, B.Height wher A.PID=B.PID
After I edit A.Weight and B.Height, How can I write the change back to A
table and B table?
 
Ad - are you using a Join statement to fill the datatable or are you using
two separate adapter queries and using a datarelation to join them? If you
are using a join server side, then you aren't going to be able to use a
CommandBUilder or call update directly - so you're going to have to loop
through the rows and dynamically build a sql statement or dynamically grab
the parameters and calll a stored proc with them.. If you have two tables
joined with a DataRelation, then you just call Update on the parent's
adapter passig in the parent table, then update on the child table passing
in the child table.
 
Back
Top