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--> what error is?

Operation must use an updateable query--> what error is?

Scheduled Pinned Locked Moved ASP.NET
databasehelptutorialquestion
11 Posts 5 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.
  • R Offline
    R Offline
    rockxuyenmandem
    wrote on last edited by
    #1

    CustCMD.CommandText = "INSERT INTO QuestionDetail(QuestionDetailID,DateofCreate, " & _ " Content,TimeofQuestion,OptionType,Answer1,Answer2,Answer3,Answer4,Answer5,Result1," & _ " Result2,Result3,Result4,Result5)Values('" & _ strQuestionDetailID & "','" & txtDate.Text & " ','" & strContent & "'," & _ intTimeofQuestion & "," & chkOptionType.Checked & ",'" & strAnswer1 & "','" & _ strAnswer2 & "','" & strAnswer3 & "','" & strAnswer4 & "','" & _ strAnswer5 & "'," & chkResult1.Checked & "," & chkResult2.Checked & "," & _ chkResult3.Checked & "," & chkResult4.Checked & "," & chkResult5.Checked & ")" Try objConn.OpenCnn(strConnection) CustCMD.Connection = objConn.Conn CustCMD.ExecuteNonQuery() --------------------------- I have error message:Operation must use an updateable query. when trying to insert a record into database, can everybody tell me what error is and how to solve it. Thanks everebody very much :-D

    I tried so hard and got so far

    J C G C 4 Replies Last reply
    0
    • R rockxuyenmandem

      CustCMD.CommandText = "INSERT INTO QuestionDetail(QuestionDetailID,DateofCreate, " & _ " Content,TimeofQuestion,OptionType,Answer1,Answer2,Answer3,Answer4,Answer5,Result1," & _ " Result2,Result3,Result4,Result5)Values('" & _ strQuestionDetailID & "','" & txtDate.Text & " ','" & strContent & "'," & _ intTimeofQuestion & "," & chkOptionType.Checked & ",'" & strAnswer1 & "','" & _ strAnswer2 & "','" & strAnswer3 & "','" & strAnswer4 & "','" & _ strAnswer5 & "'," & chkResult1.Checked & "," & chkResult2.Checked & "," & _ chkResult3.Checked & "," & chkResult4.Checked & "," & chkResult5.Checked & ")" Try objConn.OpenCnn(strConnection) CustCMD.Connection = objConn.Conn CustCMD.ExecuteNonQuery() --------------------------- I have error message:Operation must use an updateable query. when trying to insert a record into database, can everybody tell me what error is and how to solve it. Thanks everebody very much :-D

      I tried so hard and got so far

      J Offline
      J Offline
      just3ala2
      wrote on last edited by
      #2

      This is an insert statement in "update" form :-D try this one CustCMD.CommandText = "INSERT INTO QuestionDetail('" & _ strQuestionDetailID & "','" & txtDate.Text & " ','" & strContent & "'," & _ intTimeofQuestion & "," & chkOptionType.Checked & ",'" & strAnswer1 & "','" & _ strAnswer2 & "','" & strAnswer3 & "','" & strAnswer4 & "','" & _ strAnswer5 & "'," & chkResult1.Checked & "," & chkResult2.Checked & "," & _ chkResult3.Checked & "," & chkResult4.Checked & "," & chkResult5.Checked & ")" Tell me what happens with u

      Best Regards 3ala2 :)

      R 1 Reply Last reply
      0
      • R rockxuyenmandem

        CustCMD.CommandText = "INSERT INTO QuestionDetail(QuestionDetailID,DateofCreate, " & _ " Content,TimeofQuestion,OptionType,Answer1,Answer2,Answer3,Answer4,Answer5,Result1," & _ " Result2,Result3,Result4,Result5)Values('" & _ strQuestionDetailID & "','" & txtDate.Text & " ','" & strContent & "'," & _ intTimeofQuestion & "," & chkOptionType.Checked & ",'" & strAnswer1 & "','" & _ strAnswer2 & "','" & strAnswer3 & "','" & strAnswer4 & "','" & _ strAnswer5 & "'," & chkResult1.Checked & "," & chkResult2.Checked & "," & _ chkResult3.Checked & "," & chkResult4.Checked & "," & chkResult5.Checked & ")" Try objConn.OpenCnn(strConnection) CustCMD.Connection = objConn.Conn CustCMD.ExecuteNonQuery() --------------------------- I have error message:Operation must use an updateable query. when trying to insert a record into database, can everybody tell me what error is and how to solve it. Thanks everebody very much :-D

        I tried so hard and got so far

        C Offline
        C Offline
        coolestCoder
        wrote on last edited by
        #3

        Hi, I dont know but there is no space between the "Result5)" and 'values' keyword. was it by mistake?

        rockxuyenmandem wrote:

        Result5)Values('" & _

        Also in the code you have not opened the connection. Was this by mistake or purposely not mentioned in your post ?


        "A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder


        coolestCoder

        R 1 Reply Last reply
        0
        • R rockxuyenmandem

          CustCMD.CommandText = "INSERT INTO QuestionDetail(QuestionDetailID,DateofCreate, " & _ " Content,TimeofQuestion,OptionType,Answer1,Answer2,Answer3,Answer4,Answer5,Result1," & _ " Result2,Result3,Result4,Result5)Values('" & _ strQuestionDetailID & "','" & txtDate.Text & " ','" & strContent & "'," & _ intTimeofQuestion & "," & chkOptionType.Checked & ",'" & strAnswer1 & "','" & _ strAnswer2 & "','" & strAnswer3 & "','" & strAnswer4 & "','" & _ strAnswer5 & "'," & chkResult1.Checked & "," & chkResult2.Checked & "," & _ chkResult3.Checked & "," & chkResult4.Checked & "," & chkResult5.Checked & ")" Try objConn.OpenCnn(strConnection) CustCMD.Connection = objConn.Conn CustCMD.ExecuteNonQuery() --------------------------- I have error message:Operation must use an updateable query. when trying to insert a record into database, can everybody tell me what error is and how to solve it. Thanks everebody very much :-D

          I tried so hard and got so far

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          Are you using an Access database? Then you haven't set write permission on the file for the user account that is running the code.

          --- b { font-weight: normal; }

          R 1 Reply Last reply
          0
          • R rockxuyenmandem

            CustCMD.CommandText = "INSERT INTO QuestionDetail(QuestionDetailID,DateofCreate, " & _ " Content,TimeofQuestion,OptionType,Answer1,Answer2,Answer3,Answer4,Answer5,Result1," & _ " Result2,Result3,Result4,Result5)Values('" & _ strQuestionDetailID & "','" & txtDate.Text & " ','" & strContent & "'," & _ intTimeofQuestion & "," & chkOptionType.Checked & ",'" & strAnswer1 & "','" & _ strAnswer2 & "','" & strAnswer3 & "','" & strAnswer4 & "','" & _ strAnswer5 & "'," & chkResult1.Checked & "," & chkResult2.Checked & "," & _ chkResult3.Checked & "," & chkResult4.Checked & "," & chkResult5.Checked & ")" Try objConn.OpenCnn(strConnection) CustCMD.Connection = objConn.Conn CustCMD.ExecuteNonQuery() --------------------------- I have error message:Operation must use an updateable query. when trying to insert a record into database, can everybody tell me what error is and how to solve it. Thanks everebody very much :-D

            I tried so hard and got so far

            C Offline
            C Offline
            Coding C
            wrote on last edited by
            #5

            Are you using Access Database? Check if its read only. It should not be readonly. Hope This Works...

            R 1 Reply Last reply
            0
            • J just3ala2

              This is an insert statement in "update" form :-D try this one CustCMD.CommandText = "INSERT INTO QuestionDetail('" & _ strQuestionDetailID & "','" & txtDate.Text & " ','" & strContent & "'," & _ intTimeofQuestion & "," & chkOptionType.Checked & ",'" & strAnswer1 & "','" & _ strAnswer2 & "','" & strAnswer3 & "','" & strAnswer4 & "','" & _ strAnswer5 & "'," & chkResult1.Checked & "," & chkResult2.Checked & "," & _ chkResult3.Checked & "," & chkResult4.Checked & "," & chkResult5.Checked & ")" Tell me what happens with u

              Best Regards 3ala2 :)

              R Offline
              R Offline
              rockxuyenmandem
              wrote on last edited by
              #6

              Thanks for replying me, but it still error with message: Syntax error in INSERT INTO statement.

              I tried so hard and got so far

              1 Reply Last reply
              0
              • C coolestCoder

                Hi, I dont know but there is no space between the "Result5)" and 'values' keyword. was it by mistake?

                rockxuyenmandem wrote:

                Result5)Values('" & _

                Also in the code you have not opened the connection. Was this by mistake or purposely not mentioned in your post ?


                "A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder


                coolestCoder

                R Offline
                R Offline
                rockxuyenmandem
                wrote on last edited by
                #7

                Of course, I have opened connection, I also include the space between the "Result5)" and 'values' keyword, but it still error with the same message :((

                I tried so hard and got so far

                1 Reply Last reply
                0
                • G Guffa

                  Are you using an Access database? Then you haven't set write permission on the file for the user account that is running the code.

                  --- b { font-weight: normal; }

                  R Offline
                  R Offline
                  rockxuyenmandem
                  wrote on last edited by
                  #8

                  I use Access database and i have setted the full control permission, but nothing is change, still error :((

                  I tried so hard and got so far

                  G 1 Reply Last reply
                  0
                  • C Coding C

                    Are you using Access Database? Check if its read only. It should not be readonly. Hope This Works...

                    R Offline
                    R Offline
                    rockxuyenmandem
                    wrote on last edited by
                    #9

                    Yes I am using Access database, I can't unset the readonly, because i uncheck Readonly option of the project folder, but when I view the property of the folder again, It still Readonly :((

                    I tried so hard and got so far

                    1 Reply Last reply
                    0
                    • R rockxuyenmandem

                      I use Access database and i have setted the full control permission, but nothing is change, still error :((

                      I tried so hard and got so far

                      G Offline
                      G Offline
                      Guffa
                      wrote on last edited by
                      #10

                      Which user account have you given full permission? The ASP.NET code is usually run under the IIS_WPG or ASPNET account.

                      --- b { font-weight: normal; }

                      R 1 Reply Last reply
                      0
                      • G Guffa

                        Which user account have you given full permission? The ASP.NET code is usually run under the IIS_WPG or ASPNET account.

                        --- b { font-weight: normal; }

                        R Offline
                        R Offline
                        rockxuyenmandem
                        wrote on last edited by
                        #11

                        I have setted all account include IIS_WPG and ASPNET with full permission, but nothing is changed :((

                        I tried so hard and got so far

                        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