Operation must use an updateable query.

J

John

Hi

I am getting [OleDbException (0x80004005): Operation must use an updateable
query.] error on ExecuteNonQuery() . Full code is given below. The values I
have given are; ('trtrt', 'retret', '1/1/2', '333'). The application is an
asp.net webform. Any idea what is the problem?

Thanks

Regards

Dim sSQL As String = "INSERT into Applications (forenames, surname, dob,
[number]) " & _
"VALUES ('" & txtForenames.Text & "', '" & txtSurname.Text & "', '" &
txtDOB.Text & "', '" & txtNumber.Text & "')"
' Response.Write(sSQL)
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath("/") + "Staff_Application/Staff_Application.mdb" & ";"
Dim MyConn As New OleDbConnection(strConn)
Dim cmd As New OleDbCommand(sSQL, MyConn)
MyConn.Open()
cmd.ExecuteNonQuery() '<=== This line gives the error.
MyConn.Close()
 
W

W.G. Ryan eMVP

Other than Dynamic SQL (which is a disaster waiting to happen with a Web App
[and any other for that matter]) - my first guess is make sure you can write
to the db. See if you can do a simple update instead of an insert - I'm
guessing it's probably a permissioning issue and you can't write to it.

Let me know if not.

Cheers,

Bill
 
K

kapsshaw

Hi

I am getting [OleDbException (0x80004005): Operation must use an updateable
query.] error on ExecuteNonQuery() . Full code is given below. The values I
have given are; ('trtrt', 'retret', '1/1/2', '333'). The application is an
asp.net webform. Any idea what is the problem?

Thanks

Regards

Dim sSQL As String = "INSERT into Applications (forenames, surname, dob,
[number]) " & _
"VALUES ('" & txtForenames.Text & "', '" & txtSurname.Text & "', '" &
txtDOB.Text & "', '" & txtNumber.Text & "')"
' Response.Write(sSQL)
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath("/") + "Staff_Application/Staff_Application.mdb" & ";"
Dim MyConn As New OleDbConnection(strConn)
Dim cmd As New OleDbCommand(sSQL, MyConn)
MyConn.Open()
cmd.ExecuteNonQuery() '<=== This line gives the error.
MyConn.Close()

User submitted from AEWNET (http://www.aewnet.com/)
 

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

Top