database insertion - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

database insertion

i am failing to insert into an access database.am using the following code:
Dim conn As New OleDb.OleDbConnection("Microsoft.Jet.OleDb.4.0;Data Source=" & Server.MapPath("MyAccessDB.mdb"))
Dim sql As String = "INSERT INTO tblNames VALUES (@FirstName, @LastName)"
Dim cmd As New OleDb.OleDbCommand(sql, conn)
cmd.Parameters.AddWithValue("@FirstName", txtFirst.Text)
cmd.Parameters.AddWithValue("@LastName", txtLast.Text)
conn.Open()
cmd.ExecuteNonQuery()
cmd.Dispose()
conn.Close()
lblResponse.Text = "Success!"

The following error is returned
Exception Details: System.Data.OleDb.OleDbException: Operation must use an updateable query.

Can someone help please

Sign In or Register to comment.