By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,838 Members | 1,675 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,838 IT Pros & Developers. It's quick & easy.

"Operation must use an updateable query" on ExecuteNonQuery()

P: n/a
MDW
Hey all.

I'm confused. I'm trying to add a single record into an Access 2000 database
using ASP.Net. Here is the code:

objConn = New OleDbConnection(strConnect)
objConn.Open

objCommand = New OleDbCommand("INSERT INTO LOGIN_MASTER (LOGIN_ID, PWD,
F_NAME, L_NAME, TYPE_ID) VALUES ('" & strEmail & "','" & strPwd & "','" &
strFName & "','" & strLName & "','" & strType & "')",objConn)

objCommand.ExecuteNonQuery()
objConn.Close

However, when I try to run it, I get the following error:

Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Operation must use an
updateable query.

It highlights the line "objCommand.ExecuteNonQuery()" as the source of the
error. That error seems entirely out of sorts for what I thought
ExecuteNonQuery() is intended for - running SQL statements against your db
that don't return recordsets. Anyone see what could be causing the problem?
--
Hmm...they have the Internet on COMPUTERS now!
Nov 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
MDW wrote:
Hey all.

I'm confused. I'm trying to add a single record into an Access 2000
database using ASP.Net. Here is the code:

objConn = New OleDbConnection(strConnect)
objConn.Open

objCommand = New OleDbCommand("INSERT INTO LOGIN_MASTER (LOGIN_ID,
PWD, F_NAME, L_NAME, TYPE_ID) VALUES ('" & strEmail & "','" & strPwd
& "','" & strFName & "','" & strLName & "','" & strType &
"')",objConn)

objCommand.ExecuteNonQuery()
objConn.Close

However, when I try to run it, I get the following error:

Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Operation must
use an updateable query.

It highlights the line "objCommand.ExecuteNonQuery()" as the source
of the error. That error seems entirely out of sorts for what I
thought ExecuteNonQuery() is intended for - running SQL statements
against your db that don't return recordsets. Anyone see what could
be causing the problem?


Admittedly, the error message is misleading.

The reason for this error message is that the process runs
under an identity (usually ASPNET) that only has read access
to the database.

Right click on the database file in Windows Explorer, go to the
Security tab, and give the ASPNET user modify rights to the file.

--

Edge
Nov 19 '05 #2

P: n/a
MDW
Ah! Yes, that was EXACTLY it! Thanks.

I know I'm new to ASP.Net, but I was starting to wonder whether I really
knew what an updateable query was. ;)

"Edge" wrote:
MDW wrote:
Hey all.

I'm confused. I'm trying to add a single record into an Access 2000
database using ASP.Net. Here is the code:

objConn = New OleDbConnection(strConnect)
objConn.Open

objCommand = New OleDbCommand("INSERT INTO LOGIN_MASTER (LOGIN_ID,
PWD, F_NAME, L_NAME, TYPE_ID) VALUES ('" & strEmail & "','" & strPwd
& "','" & strFName & "','" & strLName & "','" & strType &
"')",objConn)

objCommand.ExecuteNonQuery()
objConn.Close

However, when I try to run it, I get the following error:

Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Operation must
use an updateable query.

It highlights the line "objCommand.ExecuteNonQuery()" as the source
of the error. That error seems entirely out of sorts for what I
thought ExecuteNonQuery() is intended for - running SQL statements
against your db that don't return recordsets. Anyone see what could
be causing the problem?


Admittedly, the error message is misleading.

The reason for this error message is that the process runs
under an identity (usually ASPNET) that only has read access
to the database.

Right click on the database file in Windows Explorer, go to the
Security tab, and give the ASPNET user modify rights to the file.

--

Edge

Nov 19 '05 #3

P: n/a
ERROR [HY000] Operation must use an updateable query
http://www.howtodothings.com/showart...sp?article=749
--
Pete
====
Read or write articles on just about anything
http://www.HowToDoThings.com

My blog
http://blogs.slcdug.org/petermorris/
Nov 19 '05 #4

P: n/a
> Right click on the database file in Windows Explorer, go to the
Security tab, and give the ASPNET user modify rights to the file.
Remember, that Access needs to create the *.ldb (lock) file in the same
directory as the database. Giving rights to just the *.mdb may not be
enough. I like to keep my *.mdb & *.ldb in a subfolder and permission that
instead.

Greg

"Edge" <ed**@edge.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... MDW wrote:
Hey all.

I'm confused. I'm trying to add a single record into an Access 2000
database using ASP.Net. Here is the code:

objConn = New OleDbConnection(strConnect)
objConn.Open

objCommand = New OleDbCommand("INSERT INTO LOGIN_MASTER (LOGIN_ID,
PWD, F_NAME, L_NAME, TYPE_ID) VALUES ('" & strEmail & "','" & strPwd
& "','" & strFName & "','" & strLName & "','" & strType &
"')",objConn)

objCommand.ExecuteNonQuery()
objConn.Close

However, when I try to run it, I get the following error:

Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Operation must
use an updateable query.

It highlights the line "objCommand.ExecuteNonQuery()" as the source
of the error. That error seems entirely out of sorts for what I
thought ExecuteNonQuery() is intended for - running SQL statements
against your db that don't return recordsets. Anyone see what could
be causing the problem?


Admittedly, the error message is misleading.

The reason for this error message is that the process runs
under an identity (usually ASPNET) that only has read access
to the database.

Right click on the database file in Windows Explorer, go to the
Security tab, and give the ASPNET user modify rights to the file.

--

Edge

Nov 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.