I cant seem to get the databse to update the tables.
i get the following error
"System.Invalid OperationExcept ion: Missing the DataColumn 'description' in
the DataTable 'Transactions' for the SourceColumn 'description'."
here is the code im using. please will someone explain what i am doing wrong
regards
Nir
Dim strConn as string ="PROVIDER=Micr osoft.Jet.OLEDB .4.0;DATA SOURCE=" &
server.mappath( "/itinium2/Database/db.mdb") & ";"
dim conn as new OLEDBConnection (strconn)
dim cmd as new OLEDBCommand
dim mydataset as new dataset()
dim mydataAdapter as new oledbdataadapte r()
dim dbrelation as dataRelation
sub page_load(sourc e as object, e as eventargs)
dim strsql as string
dim drow as datarow
dim cbd as new oledbcommandbui lder(mydataadap ter)
dim dtable as new datatable
cmd.connection = conn
cmd.commandtype = commandtype.tex t
conn.open()
'fill dataAdapter with 1st Table (transactions)
strsql = "select * from transactions"
cmd.commandtext = strsql
mydataAdapter.s electcommand = cmd
'mydataAdapter. fillschema(myda taset, schematype.mapp ed)
mydataAdapter.f ill(mydataset, "Transactio ns")
'fill dataAdapter with 2nd Table (link_transacti ons2details)
strsql = "select * from link_transactio ns2details"
cmd.commandtext = strsql
mydataAdapter.s electcommand = cmd
'mydataAdapter. fillschema(myda taset, schematype.mapp ed)
mydataAdapter.f ill(mydataset, "LinkTable" )
'fill dataAdapter with 3rd Table (transaction_de tails)
strsql = "select * from transaction_det ails"
cmd.commandtext = strsql
mydataAdapter.s electcommand = cmd
'mydataAdapter. fillschema(myda taset, schematype.mapp ed)
mydataAdapter.f ill(mydataset, "Details")
conn.close()
'******** create table relationships *************** **********
'link linktable to transactions
dbrelation = new dataRelation("T ransLink",mydat aset.tables("li nkTable")
..columns("t_id "),mydataset.ta bles("Transacti ons").columns(" id"))
mydataset.relat ions.add(dbrela tion)
'link linktable to details
dbrelation = new dataRelation("d etailLink",myda taset.tables("l inkTable")
..columns("d_id "),mydataset.ta bles("Details") .columns("id"))
mydataset.relat ions.add(dbrela tion)
'******** end create table relationships *************** *****
'Insert data into tranasaction table
dtable = mydataset.table s("Transactions ")
drow = dtable.NewRow()
drow("t_type_id ") = 1
dtable.Rows.Add (drow)
mydataadapter.i nsertcommand = cbd.getinsertco mmand()
mydataadapter.u pdate(mydataset ,"Transactions" )
myDataSet.Table s("Transactions ").AcceptChange s()
end sub
--
Message posted via http://www.dotnetmonster.com