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

Discussion in 'ASP .Net' started by =?Utf-8?B?TURX?=, Jan 1, 2005.

  1. 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!
    =?Utf-8?B?TURX?=, Jan 1, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?TURX?=

    Edge Guest

    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
    Edge, Jan 1, 2005
    #2
    1. Advertising

  3. 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
    >
    >
    >
    =?Utf-8?B?TURX?=, Jan 1, 2005
    #3
  4. Peter Morris [Air Software Ltd], Jan 1, 2005
    #4
  5. =?Utf-8?B?TURX?=

    Greg Burns Guest

    > 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" <> wrote in message
    news:%...
    > 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
    >
    >
    Greg Burns, Jan 2, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. abdul haleem
    Replies:
    3
    Views:
    411
    Wim Hollebrandse
    Oct 19, 2003
  2. =?Utf-8?B?S2Vu?=

    Operation must use an updateable query Error!!!

    =?Utf-8?B?S2Vu?=, Feb 13, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    1,265
    Hans Kesting
    Feb 13, 2004
  3. =?Utf-8?B?S2Vu?=

    Operation must use an updateable query Error!!!

    =?Utf-8?B?S2Vu?=, Feb 13, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    324
    =?Utf-8?B?S2Vu?=
    Feb 13, 2004
  4. Alphonse Giambrone

    Re: Operation must use an updateable query.

    Alphonse Giambrone, Apr 28, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    3,010
    Pravin A. Sable
    Apr 29, 2004
  5. Kevin Spencer

    Re: Operation must use an updateable query.

    Kevin Spencer, Apr 28, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    610
    Alphonse Giambrone
    Apr 29, 2004
Loading...

Share This Page