database not updating

  • Thread starter Nir Amber via DotNetMonster.com
  • Start date
N

Nir Amber via DotNetMonster.com

I cant seem to get the databse to update the tables.
i get the following error
"System.InvalidOperationException: 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=Microsoft.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 oledbdataadapter()
dim dbrelation as dataRelation


sub page_load(source as object, e as eventargs)
dim strsql as string
dim drow as datarow
dim cbd as new oledbcommandbuilder(mydataadapter)
dim dtable as new datatable
cmd.connection = conn
cmd.commandtype = commandtype.text
conn.open()

'fill dataAdapter with 1st Table (transactions)
strsql = "select * from transactions"
cmd.commandtext = strsql
mydataAdapter.selectcommand = cmd
'mydataAdapter.fillschema(mydataset, schematype.mapped)
mydataAdapter.fill(mydataset, "Transactions")

'fill dataAdapter with 2nd Table (link_transactions2details)
strsql = "select * from link_transactions2details"
cmd.commandtext = strsql
mydataAdapter.selectcommand = cmd
'mydataAdapter.fillschema(mydataset, schematype.mapped)
mydataAdapter.fill(mydataset, "LinkTable")

'fill dataAdapter with 3rd Table (transaction_details)
strsql = "select * from transaction_details"
cmd.commandtext = strsql
mydataAdapter.selectcommand = cmd
'mydataAdapter.fillschema(mydataset, schematype.mapped)
mydataAdapter.fill(mydataset, "Details")
conn.close()

'******** create table relationships *************************

'link linktable to transactions
dbrelation = new dataRelation("TransLink",mydataset.tables("linkTable")
..columns("t_id"),mydataset.tables("Transactions").columns("id"))
mydataset.relations.add(dbrelation)

'link linktable to details
dbrelation = new dataRelation("detailLink",mydataset.tables("linkTable")
..columns("d_id"),mydataset.tables("Details").columns("id"))
mydataset.relations.add(dbrelation)

'******** end create table relationships ********************

'Insert data into tranasaction table
dtable = mydataset.tables("Transactions")
drow = dtable.NewRow()
drow("t_type_id") = 1
dtable.Rows.Add(drow)
mydataadapter.insertcommand = cbd.getinsertcommand()
mydataadapter.update(mydataset,"Transactions")
myDataSet.Tables("Transactions").AcceptChanges()


end sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top