By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,109 Members | 969 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,109 IT Pros & Developers. It's quick & easy.

Trying to Insert a Record

P: n/a
I'm trying to insert a new record into an MS Access table. The code below
compiles and runs, but it doesn't write a record into the table. Can
someone tell me why?

Dim thisSelectCommand As New OleDb.OleDbCommand("SELECT * FROM Sessions",
Me.OleDbConnection1)

Dim thisDataAdapter As New OleDb.OleDbDataAdapter(thisSelectCommand)

Dim thisDataset As New System.Data.DataSet()

thisDataAdapter.Fill(thisDataset, "Sessions")

thisDataAdapter.InsertCommand = New OleDb.OleDbCommand("INSERT INTO Sessions
(Notes) VALUES('Yadda')")

thisDataAdapter.Update(thisDataset, "Sessions")

thisDataset.AcceptChanges()
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
this another solution to add record
---------------
Dim thisinsDataAdapter As OleDb.OleDbDataAdapte
Dim thisinsDataset As New System.Data.DataSet(
thisinsDataAdapter= New OleDb.OleDb.OleDbDataAdapter("INSERT INTO Session
(Notes) VALUES('Yadda')"
thisinsDataAdapter(thisinsDataset, "Sessions"

and you can refresh you 1st dataset again

hope it help u
Manj

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.