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 and MFC! HHHEEEELLLLPPPP!

Database and MFC! HHHEEEELLLLPPPP!

Scheduled Pinned Locked Moved C / C++ / MFC
databasec++helpquestionannouncement
5 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.
  • M Offline
    M Offline
    MFC is the Best
    wrote on last edited by
    #1

    hello! i have a dialogbased mfc program. in this programm i have several strings. CString str='Text'; now i want the string read into a access database. the table inside the database is empty, i have only 2 columns (one column for the number of the string (automatically) and the second one for the string). i use ODBC and tried this here: CMyDataBase db; db.Open(); db.m_zweiter=strText; db.Update(); db.Close(); WHAT`S WRONG? :~ can somebody help me? thanks MFC

    M A 2 Replies Last reply
    0
    • M MFC is the Best

      hello! i have a dialogbased mfc program. in this programm i have several strings. CString str='Text'; now i want the string read into a access database. the table inside the database is empty, i have only 2 columns (one column for the number of the string (automatically) and the second one for the string). i use ODBC and tried this here: CMyDataBase db; db.Open(); db.m_zweiter=strText; db.Update(); db.Close(); WHAT`S WRONG? :~ can somebody help me? thanks MFC

      M Offline
      M Offline
      Marc Clifton
      wrote on last edited by
      #2

      Well, without seeing what's being your Open, Update, and Close functions, it's hard to say. What's your SQL statement look like, or are you trying to populate a dataset? Besides, you declare CString str and then have a ...=strText. Was that just a typo in the example? Where is the program failing? Connection strings can be complicated to set up--maybe it's the connection string you're using. Also, have you set up an ODBC data source under "Data Sources (ODBC)" usually in the control panel or adminstrative tools program groups. Marc Help! I'm an AI running around in someone's f*cked up universe simulator.

      M 1 Reply Last reply
      0
      • M Marc Clifton

        Well, without seeing what's being your Open, Update, and Close functions, it's hard to say. What's your SQL statement look like, or are you trying to populate a dataset? Besides, you declare CString str and then have a ...=strText. Was that just a typo in the example? Where is the program failing? Connection strings can be complicated to set up--maybe it's the connection string you're using. Also, have you set up an ODBC data source under "Data Sources (ODBC)" usually in the control panel or adminstrative tools program groups. Marc Help! I'm an AI running around in someone's f*cked up universe simulator.

        M Offline
        M Offline
        MFC is the Best
        wrote on last edited by
        #3

        hi! yes, it was a mistake. both times it must be CString strText. i tried several things, sometimes the mistake was in that row: db.m_zweiter=strText; or everything was fine, but nothing changed in the database.

        M 1 Reply Last reply
        0
        • M MFC is the Best

          hi! yes, it was a mistake. both times it must be CString strText. i tried several things, sometimes the mistake was in that row: db.m_zweiter=strText; or everything was fine, but nothing changed in the database.

          M Offline
          M Offline
          Marc Clifton
          wrote on last edited by
          #4

          I just read something in the help about CDaoDatabase that if you don't perform a Commit (or close all your record sets) that when you perform a Close, all pending transactions are rolled back. Maybe the same thing is true for ODBC. It's been a while since I've used ODBC. Marc Help! I'm an AI running around in someone's f*cked up universe simulator.

          1 Reply Last reply
          0
          • M MFC is the Best

            hello! i have a dialogbased mfc program. in this programm i have several strings. CString str='Text'; now i want the string read into a access database. the table inside the database is empty, i have only 2 columns (one column for the number of the string (automatically) and the second one for the string). i use ODBC and tried this here: CMyDataBase db; db.Open(); db.m_zweiter=strText; db.Update(); db.Close(); WHAT`S WRONG? :~ can somebody help me? thanks MFC

            A Offline
            A Offline
            Alexandru Savescu
            wrote on last edited by
            #5

            You need to do this: 1. Create a database object and open it. 2. Create a recordset object and open it. You send the SQL statement to the Recordset. 3. See CRecordset member functions for details how to insert, update and delete rows 4. You close the recordset and then the database. Best regards, Alexandru Savescu

            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