using oledb to insert data into msaccess

qa_bhatti

New member
Joined
Feb 10, 2007
Messages
3
Programming Experience
10+
i use the code;
Dim TrDA As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter("SELECT TransID,MemberNo FROM Tbl_Transactions", OleDbConnection1)
Dim varinsertCommand As String

varinsertCommand = "Insert into Tbl_Transactions (MemberNo) values ('AD099')"
TrDA.InsertCommand = New OleDb.OleDbCommand(varinsertCommand, OleDbConnection1)



Dim TrDs As DataSet = New DataSet
TrDA.Fill(TrDs, "Tbl_Transactions")


Dim TrRow As DataRow = TrDs.Tables("Tbl_Transactions").Rows(10)
TrRow("memberno") = "New Transaction"
TrDA.Update(TrDs)
:)

but i get an error

An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
:confused:
please assist
 
MS developed a better way of doing data access than that.. you can read all about it in the DW2 link in my signature...
 
dear vis781 and cjard,
Thank you for all your help , but i am still in problems.

what i am doing is as follow;

1. I have configured two datasets using the wizard to pick data and display on the form. This works very well and the data fills and displays as required.

2. I then need to save the calculated result form the form into a third table transactions. As this table(dataset) is not linked to the form , i need to save the data caculated on the form into the Transactions. The OleDbConnection1 was created by the wizard.

3. Using Oledb and knowing i am updating to an access database , how do i go about this.


4.unfortunately i cannot give the line number as when the code breaks ; if i click break gives the error;
There is no source code available for the current location
if i click continue it breaks.

5. what i was tring to do first is get the acces syntext correct so as to append at least one record. then getting the data from the form and creating a new record will be my next challenge.
 
Back
Top