well, it worked in sqlserver Insert fails in oledb

G

Guest

This insert does not work and i don't know why. I get the following error
System.Data.OleDb.OleDbException: Operation must use an updateable query.
on the cmdInsert.ExecuteNonQuery()
I'm sure it's going to be simple
thanks
kes
Function AddStone(ByVal thsStone)
Dim conAddStone As OleDbConnection
Dim strInsert As String
Dim cmdInsert As OleDbCommand
conAddStone = New
OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=" & thsSitePath
& "db\damarstone.mdb")
strInsert = "Insert into typ (TypName) Values(@thsStone)"
cmdInsert = New OleDbCommand(strInsert, conAddStone)
'cmdInsert.Parameters.Add("@thsStone", thsStone)
conAddStone.Open()
cmdInsert.ExecuteNonQuery()
conAddStone.Close()
End Function
 
W

W.G. Ryan eMVP

First make sure you have a Key on the table and that you can actually write
to the access db. Next, replace your params with ? and try it again.
 
G

Guest

Thank You for your reply.

Primary Key is typID as an auto Number, I replaced the param with a question
mark and i get the same problem. I even try:
Insert into typ (TypName) Values('Kris') What or who needs to be added to
the directory security for this file?
THanks
kes
 

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