ExecuteNonQuery

G

Guest

I am trying to do a simple ExecuteNonQuery method on a very simple INSERT
statement. Please see code below.

Could anyone see why I would continue to get an "Operation must use an
updateable query" error on such a simple code fragment?

The connection (cn) is open.

dim sql1 as string = "insert into st_order (order_id) values ('9662441')"
dim cmd1 as new OleDbCommand
cmd1.connection = cn
cmd1.commandtext = sql1
cmd1.ExecuteNonQuery()
 
M

Mythran

Paul said:
I am trying to do a simple ExecuteNonQuery method on a very simple INSERT
statement. Please see code below.

Could anyone see why I would continue to get an "Operation must use an
updateable query" error on such a simple code fragment?

The connection (cn) is open.

dim sql1 as string = "insert into st_order (order_id) values ('9662441')"
dim cmd1 as new OleDbCommand
cmd1.connection = cn
cmd1.commandtext = sql1
cmd1.ExecuteNonQuery()

Access database? I'm not positive, but try this:

Dim sql1 As String = "insert into st_order (order_id) values (""9662441"")"

Once again, not sure about it..but the single quotes may be your problem.

Mythran
 
G

Guest

Thanks but no, this did not help.

Mythran said:
Access database? I'm not positive, but try this:

Dim sql1 As String = "insert into st_order (order_id) values (""9662441"")"

Once again, not sure about it..but the single quotes may be your problem.

Mythran
 
R

rbutch

Permissions is exactly what it is. i cant count how many times its happened to me.
right click go to properties/ security / and change the User(s) you need to allow read or read & execute or full control and you should be fine

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 

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