problem in updating multiple tables in dataset...

mzim

Well-known member
Joined
Jun 3, 2004
Messages
187
Location
Other side of the rock
Programming Experience
1-3
[font=verdana,arial,helvetica] [/font] [font=verdana, arial, helvetica]halu. im a newbie
i used datagrid to place multiple tables w/ corresponding data from the database
i could update the first table and it saves into the database what i've change but when i'm going to update the second table it gives me an error: missing the datacolumn "code" in the Datatable 'gallons' for the SourceColumn 'code'
i dont know how to figure it out.

[/font]

[font=verdana,arial,helvetica]code:[/font]
dim cn as new sqlconnection("......")
dim cm as new sqlcommand()
Private ds as new dataset()
dim da as new Sqldataadapter()
dim cmdtext as string

'form load

cn.open
cm.connection=cn
cm.commandtype = commandtype.storedprocedure
cmdtext = "select * from customertable ; select * from gallons"
da.selectcommand = new sqlcommand(cmdtext, cn)
da.tablemappings="Table","Customer"
da.tablemappings="Table1","Gallons"
da.fill(ds)
datagrid1.datasource = ds

'to save the changes

if ds.haschanges then
dim cb as Sqlcommandbuilder
da.selectcommand = new sqlcommand(cmdtext,cn)
cb = new sqlcommandbuilder(da)
da.Update(ds,"Customer")
da.Update(ds,"Gallons")
end if
[font=verdana, arial, helvetica]tanx in advance...;)
[/font]
 
Top Bottom