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.
tanx in advance....Code: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
![]()




Reply With Quote