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. General Programming
  3. C / C++ / MFC
  4. Database Update????? Urgent

Database Update????? Urgent

Scheduled Pinned Locked Moved C / C++ / MFC
databasehelpquestionannouncement
7 Posts 3 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.
  • S Offline
    S Offline
    Small Rat
    wrote on last edited by
    #1

    Hi, I want to use CDatabase::ExecuteSQL to execute a update sql statement to Access database. I use the following sql statement. sql="update table_name set col_name=\"dd'ee\" where id=1"; (the content of col_name has a ') it doesn't work. Please help me solve the problem!! thanks a lot!! Alan

    P T 3 Replies Last reply
    0
    • S Small Rat

      Hi, I want to use CDatabase::ExecuteSQL to execute a update sql statement to Access database. I use the following sql statement. sql="update table_name set col_name=\"dd'ee\" where id=1"; (the content of col_name has a ') it doesn't work. Please help me solve the problem!! thanks a lot!! Alan

      P Offline
      P Offline
      palbano
      wrote on last edited by
      #2

      Did you test the SQL statement in Access? It looks like there might be an error in it. It appears you have an apostrophe character in the string value for the col_name field. I am not positive but i seem to remember that Access and other relational DB's do not support that character in string data.

      "No matter where you go, there your are." - Buckaroo Banzai

      -pete

      S 1 Reply Last reply
      0
      • P palbano

        Did you test the SQL statement in Access? It looks like there might be an error in it. It appears you have an apostrophe character in the string value for the col_name field. I am not positive but i seem to remember that Access and other relational DB's do not support that character in string data.

        "No matter where you go, there your are." - Buckaroo Banzai

        -pete

        S Offline
        S Offline
        Small Rat
        wrote on last edited by
        #3

        Yes, I test sql statement, it works.

        1 Reply Last reply
        0
        • S Small Rat

          Hi, I want to use CDatabase::ExecuteSQL to execute a update sql statement to Access database. I use the following sql statement. sql="update table_name set col_name=\"dd'ee\" where id=1"; (the content of col_name has a ') it doesn't work. Please help me solve the problem!! thanks a lot!! Alan

          T Offline
          T Offline
          TaknuMone
          wrote on last edited by
          #4

          Try this syntax: strQuery = "UPDATE employees " strQuery += "SET employee_lastname = " + m_Value; strQuery += "WHERE employee_id = " + nEmpId; remove those slashes TaknUmone

          S 1 Reply Last reply
          0
          • S Small Rat

            Hi, I want to use CDatabase::ExecuteSQL to execute a update sql statement to Access database. I use the following sql statement. sql="update table_name set col_name=\"dd'ee\" where id=1"; (the content of col_name has a ') it doesn't work. Please help me solve the problem!! thanks a lot!! Alan

            P Offline
            P Offline
            palbano
            wrote on last edited by
            #5

            alanshen209 wrote: it doesn't work. What does that mean? Does it throw an exception?

            "No matter where you go, there your are." - Buckaroo Banzai

            -pete

            S 1 Reply Last reply
            0
            • T TaknuMone

              Try this syntax: strQuery = "UPDATE employees " strQuery += "SET employee_lastname = " + m_Value; strQuery += "WHERE employee_id = " + nEmpId; remove those slashes TaknUmone

              S Offline
              S Offline
              Small Rat
              wrote on last edited by
              #6

              but we have use ''/"" to the char column. because the content of the column include a ', so I change teh one pair of '' to "".

              1 Reply Last reply
              0
              • P palbano

                alanshen209 wrote: it doesn't work. What does that mean? Does it throw an exception?

                "No matter where you go, there your are." - Buckaroo Banzai

                -pete

                S Offline
                S Offline
                Small Rat
                wrote on last edited by
                #7

                when I run my sql statement, I got a error msgbox.

                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