Home All Groups Group Topic Archive Search About

How to write back to two table with GridView

Author
21 Nov 2005 2:12 PM
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?

Author
21 Nov 2005 5:38 PM
W.G. Ryan - MVP
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.
Show quote
"ad" <fly***@wfes.tcc.edu.tw> wrote in message
news:eEA5LWq7FHA.1020@TK2MSFTNGP15.phx.gbl...
>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?
>
>

AddThis Social Bookmark Button