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. VC++ / ODBC / CSV files : how to perform UDDATE and DELETE statements

VC++ / ODBC / CSV files : how to perform UDDATE and DELETE statements

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++tutorialquestionannouncement
4 Posts 2 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.
  • Q Offline
    Q Offline
    Qadddd
    wrote on last edited by
    #1

    Hello, I was writing a little application and I wanted to save some informations in a CSV format file. I expected to use ODBC to interface my file. I wrote some INSERT and SELECT statements and it worked fine. But when I wanted to use the UPDATE, I got an error message saying that "my command had a bad format" ... They could have said "ODBC doesn't support UPDATE or DELETE" !!!! Because, after having searched a while what could be wrong in my format , I came on the web and found a note on microsoft site saying that ODBC doesn't support UPDATE or DELETE ... Nevertheless, is there really no way to make it work? Should I write some code that will delete the line from the file and use an INSERT after ? Is there any way to retrieve the path I set in ODBC to access my file ? Thanks in advance for help DD

    D 1 Reply Last reply
    0
    • Q Qadddd

      Hello, I was writing a little application and I wanted to save some informations in a CSV format file. I expected to use ODBC to interface my file. I wrote some INSERT and SELECT statements and it worked fine. But when I wanted to use the UPDATE, I got an error message saying that "my command had a bad format" ... They could have said "ODBC doesn't support UPDATE or DELETE" !!!! Because, after having searched a while what could be wrong in my format , I came on the web and found a note on microsoft site saying that ODBC doesn't support UPDATE or DELETE ... Nevertheless, is there really no way to make it work? Should I write some code that will delete the line from the file and use an INSERT after ? Is there any way to retrieve the path I set in ODBC to access my file ? Thanks in advance for help DD

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Qadddd wrote: Because, after having searched a while what could be wrong in my format , I came on the web and found a note on microsoft site saying that ODBC doesn't support UPDATE or DELETE ... You must've interpreted it wrong because I use Update() and Delete() all the time with ODBC. It works fine.


      A rich person is not the one who has the most, but the one that needs the least.

      Q 1 Reply Last reply
      0
      • D David Crow

        Qadddd wrote: Because, after having searched a while what could be wrong in my format , I came on the web and found a note on microsoft site saying that ODBC doesn't support UPDATE or DELETE ... You must've interpreted it wrong because I use Update() and Delete() all the time with ODBC. It works fine.


        A rich person is not the one who has the most, but the one that needs the least.

        Q Offline
        Q Offline
        Qadddd
        wrote on last edited by
        #3

        Hello, I was talking of this limitation only for ODBC used to access CSV files (and maybe others)! But fortunately, it works fine with MySQL and SQL Server (for those I already used) and probably Oracle and a lot of more DB's, else it would have a very reduced interest to use ODBC. Because if we do SELECT to extract our data and INSERT to add them, we are obliged to UPDATE and also DELETE them ... Look at http://support.microsoft.com/?kbid=281759 Nevertheless, I have 2 remarks for Microsoft : 1) I find to easy to say "We don't support UPDATE nor DELETE for ODBC on CSV file" 2) I would have prefered a clear message as "This SQL statement is nor supported by this ODBC driver" instead of "Bad request format" ! The 1st msg indicates clearly that it works (not) as designed, while the 2nd msg can mean that you are stupid and don't how to write a SQL UPDATE statement ... I am lucky, my files will become soon a table under MySQL and, as they are not so big, I have been writing some dirty code to rapidly do the UDDATE. Regards, DD

        D 1 Reply Last reply
        0
        • Q Qadddd

          Hello, I was talking of this limitation only for ODBC used to access CSV files (and maybe others)! But fortunately, it works fine with MySQL and SQL Server (for those I already used) and probably Oracle and a lot of more DB's, else it would have a very reduced interest to use ODBC. Because if we do SELECT to extract our data and INSERT to add them, we are obliged to UPDATE and also DELETE them ... Look at http://support.microsoft.com/?kbid=281759 Nevertheless, I have 2 remarks for Microsoft : 1) I find to easy to say "We don't support UPDATE nor DELETE for ODBC on CSV file" 2) I would have prefered a clear message as "This SQL statement is nor supported by this ODBC driver" instead of "Bad request format" ! The 1st msg indicates clearly that it works (not) as designed, while the 2nd msg can mean that you are stupid and don't how to write a SQL UPDATE statement ... I am lucky, my files will become soon a table under MySQL and, as they are not so big, I have been writing some dirty code to rapidly do the UDDATE. Regards, DD

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Qadddd wrote: I am lucky, my files will become soon a table under MySQL and, as they are not so big, I have been writing some dirty code to rapidly do the UDDATE. You're on your way then. I was going to suggest importing the file into an Access table, making the modifications, then exporting the data back to a CSV file. It would have taken a few more seconds, but would have solved the problem.


          A rich person is not the one who has the most, but the one that needs the least.

          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