Trying to Insert a Record

C

Curt Emich

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()
 
G

Guest

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
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,905
Latest member
Kristy_Poole

Latest Threads

Top