HELP! Operation must use an updateable query

Discussion in 'ASP.NET / ASP.NET Core' started by chriscanali, Jul 1, 2005.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I'm trying to insert rows into an Access database connection. Here's the code i'm using...




    Dim MdbConn As New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=" & Server.MapPath("/_database/PreTest.mdb"))


    MdbConn.Open()


    Dim InsertCmd As New OleDbCommand("INSERT INTO PreTest (Username) VALUES ('" & User.Identity.Name & "')", MdbConn)


    InsertCmd.ExecuteNonQuery()





    And when I run it I get...
    Operation must use an updateable query.


    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.

    Source Error:





    Code:
    Line 62: 
    Line 63:         Dim InsertCmd As New OleDbCommand("INSERT INTO PreTest (Username) VALUES ('" & User.Identity.Name & "')", MdbConn)
    Line 64:         InsertCmd.ExecuteNonQuery()
    Line 65: 
    Line 66:     End Sub

    Any ideas? Thanks!
     
  2. It could be that your code is fine, but your Access db is write protected (either the mdb file itself or the directory your file resides in).


    Have you set directory permissions to read and write for that particular directory?
     
  3. That did it!

    I should have thought have thought of that, I've been sitting here banging my head against a wall all day. That was a big help [​IMG]
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page