Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Trying to Insert a Record

Thread Tools

Trying to Insert a Record

Curt Emich
Posts: 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",

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")


Reply With Quote
Posts: 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

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
You cannot add or change a record because a related record is required in table 'lok" André ASP .Net 0 06-25-2006 01:30 PM
How to insert a new record in detailsview when there are no record Frits van Soldt ASP .Net Web Controls 2 11-17-2005 09:18 AM
Retrieving Record Key while creating the record. =?Utf-8?B?SnVzdGlu?= ASP .Net 4 10-05-2004 08:11 PM
insert record using stored proc returns no error but doesn't inserd record ASP General 1 01-09-2004 04:53 PM
" Invalid Disk Table in Boot Record - Boot Record could not be repaired " reply@newsgroup.please Computer Support 2 12-01-2003 05:37 AM