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. SQL and Visual C++

SQL and Visual C++

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

    hello @all, i have an mfc program and an access database. i connected them with odbc. how can i make the following sql statement in my mfc programm? 'select distinct xy from mytable' thank you very much. mfc

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

      hello @all, i have an mfc program and an access database. i connected them with odbc. how can i make the following sql statement in my mfc programm? 'select distinct xy from mytable' thank you very much. mfc

      L Offline
      L Offline
      lemonzc1949
      wrote on last edited by
      #2

      :cool:Use CRecordset Open() member function.

      M 1 Reply Last reply
      0
      • L lemonzc1949

        :cool:Use CRecordset Open() member function.

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

        thanks for reply, but it does not work. somewhere i make a mistake. i want to read out 'xy' from a table 'mytable' and put these CString into a ComboBox: Now i tried this: CMyDatabase db; db.Open( CRecordset::dynaset, _T( "Select distinct xy from mytable" ) ); db.MoveFirst(); while(!db.IsEOF()) { m_ctrlCombo.AddString(db.m_xy); db.MoveNext(); } db.Close(); UpdateData(false); i get the error, when i want to use this funktion. the error: error with the call of a data record thanks mfc

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

          thanks for reply, but it does not work. somewhere i make a mistake. i want to read out 'xy' from a table 'mytable' and put these CString into a ComboBox: Now i tried this: CMyDatabase db; db.Open( CRecordset::dynaset, _T( "Select distinct xy from mytable" ) ); db.MoveFirst(); while(!db.IsEOF()) { m_ctrlCombo.AddString(db.m_xy); db.MoveNext(); } db.Close(); UpdateData(false); i get the error, when i want to use this funktion. the error: error with the call of a data record thanks mfc

          L Offline
          L Offline
          lemonzc1949
          wrote on last edited by
          #4

          :) you can use some SQL tools(such SQL Server's Query Analyzer) which can chech you SQL statement, go, if you SQL statement is right that you can see the result for you query. My English is not good, but I can try my best for your problem.:cool: hi

          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