Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Operation must use an updateable query

Operation must use an updateable query

Scheduled Pinned Locked Moved ASP.NET
databasehelpquestion
10 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    Weiye Chen
    wrote on last edited by
    #1

    Does anyone know what this error message means? Operation must use an updateable query It points to my ExecuteNonQuery() statement. Below are my code:

    OleDbConnection oleDbConnection = new OleDbConnection(this.DatabaseConnectionString);
    OleDbCommand oleDbCreateReservationCommand = oleDbConnection.CreateCommand();

    oleDbConnection.Open();
    oleDbCreateReservationCommand.CommandText = "INSERT INTO Reservations (CustomerName, NumSeats, TimeReserved) VALUES ('" + nameCustomer + "', " + numSeatsToReserve.ToString() + ", '" + timeReservation + "')";

    oleDbCreateReservationCommand.ExecuteNonQuery();
    oleDbConnection.Close();

    Weiye Chen When pursuing your dreams, don't forget to enjoy your life...

    B G 2 Replies Last reply
    0
    • W Weiye Chen

      Does anyone know what this error message means? Operation must use an updateable query It points to my ExecuteNonQuery() statement. Below are my code:

      OleDbConnection oleDbConnection = new OleDbConnection(this.DatabaseConnectionString);
      OleDbCommand oleDbCreateReservationCommand = oleDbConnection.CreateCommand();

      oleDbConnection.Open();
      oleDbCreateReservationCommand.CommandText = "INSERT INTO Reservations (CustomerName, NumSeats, TimeReserved) VALUES ('" + nameCustomer + "', " + numSeatsToReserve.ToString() + ", '" + timeReservation + "')";

      oleDbCreateReservationCommand.ExecuteNonQuery();
      oleDbConnection.Close();

      Weiye Chen When pursuing your dreams, don't forget to enjoy your life...

      B Offline
      B Offline
      Bee Master
      wrote on last edited by
      #2

      http://support.microsoft.com/default.aspx?scid=kb;en-us;q175168[^] //Start of joke Never comment ur code. If it was hard to write, it should be hard to understand !!! //End of joke

      W 2 Replies Last reply
      0
      • W Weiye Chen

        Does anyone know what this error message means? Operation must use an updateable query It points to my ExecuteNonQuery() statement. Below are my code:

        OleDbConnection oleDbConnection = new OleDbConnection(this.DatabaseConnectionString);
        OleDbCommand oleDbCreateReservationCommand = oleDbConnection.CreateCommand();

        oleDbConnection.Open();
        oleDbCreateReservationCommand.CommandText = "INSERT INTO Reservations (CustomerName, NumSeats, TimeReserved) VALUES ('" + nameCustomer + "', " + numSeatsToReserve.ToString() + ", '" + timeReservation + "')";

        oleDbCreateReservationCommand.ExecuteNonQuery();
        oleDbConnection.Close();

        Weiye Chen When pursuing your dreams, don't forget to enjoy your life...

        G Offline
        G Offline
        Graphfixz
        wrote on last edited by
        #3

        it means the database needs read, write permissions.

        W 1 Reply Last reply
        0
        • G Graphfixz

          it means the database needs read, write permissions.

          W Offline
          W Offline
          Weiye Chen
          wrote on last edited by
          #4

          I have checked my database file but it isn't read only. Weiye Chen When pursuing your dreams, don't forget to enjoy your life...

          N 1 Reply Last reply
          0
          • B Bee Master

            http://support.microsoft.com/default.aspx?scid=kb;en-us;q175168[^] //Start of joke Never comment ur code. If it was hard to write, it should be hard to understand !!! //End of joke

            W Offline
            W Offline
            Weiye Chen
            wrote on last edited by
            #5

            I have checked the article but i am still unable to figure out the problem. In fact, my code is working fine before my computer was down, which i later reformatted everything and restored my application. Btw, is there any particular place to store database files? I noticed the server explorer in VS allows me to create a connection to my database, but i have no idea how to make use of the connection. :confused: Weiye Chen When pursuing your dreams, don't forget to enjoy your life...

            B 1 Reply Last reply
            0
            • W Weiye Chen

              I have checked the article but i am still unable to figure out the problem. In fact, my code is working fine before my computer was down, which i later reformatted everything and restored my application. Btw, is there any particular place to store database files? I noticed the server explorer in VS allows me to create a connection to my database, but i have no idea how to make use of the connection. :confused: Weiye Chen When pursuing your dreams, don't forget to enjoy your life...

              B Offline
              B Offline
              Bee Master
              wrote on last edited by
              #6

              Weiye Chen wrote: i later reformatted everything and restored my application Did you install framework before installing IIS. Weiye Chen wrote: is there any particular place to store database files Nothing specific as long as the user used by application has rights on the folder. Btw, did you give rights on the datafile file to IUSR_<> or ASPNET user or whichever user your application is using. Weiye Chen wrote: I noticed the server explorer in VS allows me to create a connection to my database, but i have no idea how to make use of the connection When you drag n drop tables from Server Explorer, it will automatically create objects of SqlDataAdapter and SqlCommand. You can test your sql operation using those objects. //Start of joke Never comment ur code. If it was hard to write, it should be hard to understand !!! //End of joke

              W 1 Reply Last reply
              0
              • B Bee Master

                Weiye Chen wrote: i later reformatted everything and restored my application Did you install framework before installing IIS. Weiye Chen wrote: is there any particular place to store database files Nothing specific as long as the user used by application has rights on the folder. Btw, did you give rights on the datafile file to IUSR_<> or ASPNET user or whichever user your application is using. Weiye Chen wrote: I noticed the server explorer in VS allows me to create a connection to my database, but i have no idea how to make use of the connection When you drag n drop tables from Server Explorer, it will automatically create objects of SqlDataAdapter and SqlCommand. You can test your sql operation using those objects. //Start of joke Never comment ur code. If it was hard to write, it should be hard to understand !!! //End of joke

                W Offline
                W Offline
                Weiye Chen
                wrote on last edited by
                #7

                Bee Master wrote: Did you install framework before installing IIS. Yes, i installed IIS after finishing setting up my Windows XP. Then i installed VS.NET. Bee Master wrote: Nothing specific as long as the user used by application has rights on the folder. Btw, did you give rights on the datafile file to IUSR_<> or ASPNET user or whichever user your application is using. I am using my account with administrator rights to run my application from VS.NET. So far, i didn't specify any rights to my database file or rather i didn't know how to do so. I used to just create my database file using Access and open it through my application. Weiye Chen When pursuing your dreams, don't forget to enjoy your life...

                1 Reply Last reply
                0
                • B Bee Master

                  http://support.microsoft.com/default.aspx?scid=kb;en-us;q175168[^] //Start of joke Never comment ur code. If it was hard to write, it should be hard to understand !!! //End of joke

                  W Offline
                  W Offline
                  Weiye Chen
                  wrote on last edited by
                  #8

                  Anyway, thanks for you help. I just found out that the Internet Guest Account wasn't enabled. I got mixed up with the Windows Guest Account. I manage to find the correct account under Administrative Tools->Computer Management. :doh: Weiye Chen When pursuing your dreams, don't forget to enjoy your life...

                  1 Reply Last reply
                  0
                  • W Weiye Chen

                    I have checked my database file but it isn't read only. Weiye Chen When pursuing your dreams, don't forget to enjoy your life...

                    N Offline
                    N Offline
                    naresh_pandey13
                    wrote on last edited by
                    #9

                    I m facing the prob toooo.But not able to find the solution .How it makes database read only I don't know . This is Jitendra

                    W 1 Reply Last reply
                    0
                    • N naresh_pandey13

                      I m facing the prob toooo.But not able to find the solution .How it makes database read only I don't know . This is Jitendra

                      W Offline
                      W Offline
                      Weiye Chen
                      wrote on last edited by
                      #10

                      Well, the cause of my problem is that the Internet Guest account isn't enabled. It is located under Administrative Tools->Computer Management of my Control Panel. (I am running on WindowsXP). Weiye Chen When pursuing your dreams, don't forget to enjoy your life...

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups