Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > "Operation must use an updateable query" on ExecuteNonQuery()

Reply
Thread Tools

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

 
 
=?Utf-8?B?TURX?=
Guest
Posts: n/a
 
      01-01-2005
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!
 
Reply With Quote
 
 
 
 
Edge
Guest
Posts: n/a
 
      01-01-2005
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


 
Reply With Quote
 
 
 
 
=?Utf-8?B?TURX?=
Guest
Posts: n/a
 
      01-01-2005
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
>
>
>

 
Reply With Quote
 
Peter Morris [Air Software Ltd]
Guest
Posts: n/a
 
      01-01-2005
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/


 
Reply With Quote
 
Greg Burns
Guest
Posts: n/a
 
      01-02-2005
> 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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Operation must use an updateable query. Kevin Spencer ASP .Net 3 04-29-2004 01:17 PM
Re: Operation must use an updateable query. Alphonse Giambrone ASP .Net 3 04-29-2004 02:44 AM
Operation must use an updateable query Error!!! =?Utf-8?B?S2Vu?= ASP .Net 6 02-13-2004 03:45 PM
Operation must use an updateable query Error!!! =?Utf-8?B?S2Vu?= ASP .Net 0 02-13-2004 01:46 PM
Operation must use an updateable query error. abdul haleem ASP .Net 3 10-19-2003 05:53 PM



Advertisments