473,386 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

database not updating

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("linkTab le")
..columns("t_id"),mydataset.tables("Transactions") .columns("id"))
mydataset.relations.add(dbrelation)

'link linktable to details
dbrelation = new dataRelation("detailLink",mydataset.tables("linkTa ble")
..columns("d_id"),mydataset.tables("Details").colu mns("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

--
Message posted via http://www.dotnetmonster.com
Nov 19 '05 #1
0 1086

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Test Person | last post by:
Hi I'm having trouble with updating my database which is SqlServer. I'm using the update command and only the dataset is being changed not the actual row in the database. Best Regards
4
by: Frnak McKenney | last post by:
I'm using an in-core DataSet as an image of my application's 'database' (a multi-table Access97 mdb file). Updates are made to the DataTables within the DataSet via forms with bound TextBoxes,...
9
by: Pam Ammond | last post by:
I need the code to update the database when Save is clicked and a text field has changed. This should be very easy since I used Microsoft's wizards for the OleDBAdapter and OleDBConnection, and...
1
by: Luis Esteban Valencia | last post by:
Hello Everyone, Iam an intermediate ASP.Net programmer and iam facing a challenging task. I have a table in MS-SQL server database called 'Members'. The table has following fields... ...
0
by: cwbp17 | last post by:
I'm having trouble updating individual datagrid cells. Have two tables car_master (columns include Car_ID, YEAR,VEHICLE) and car_detail (columns include Car_ID,PRICE,MILEAGE,and BODY);both tables...
2
by: Greg | last post by:
I'm using the Framework 1.1, so I don't have access to the new DataGridView object. What I'm wondering is, is there a really simple way to bind a plain datagrid to a database in such a way that...
3
by: Zelalem | last post by:
Hi In the VB.6 application program I know that there are functionalities used for updating,editing the main database designed with Ms access or any other DBMS What I need is to keep the...
1
by: jonbartlam | last post by:
Hi There I'm not sure what exactly is going wrong here. I'm writing an application that retreives a table from a database (tbl_internalfaults) and updates it. (Actually, just the status column will...
25
by: zmickle | last post by:
Excuse my noobness. I am managing an access database that is shared by 4 users. Management does not want to use any technologies outside of access for this application (no SQL Server, etc). I...
0
MrMancunian
by: MrMancunian | last post by:
How to create a database connection without using wizards Introduction I've seen a lot of questions on the net about getting data from, and saving data to databases. Here's a little insight how...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.