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 Commands

SQL Commands

Scheduled Pinned Locked Moved C / C++ / MFC
questiondatabase
2 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.
  • Z Offline
    Z Offline
    Zero_One_ADO
    wrote on last edited by
    #1

    Hello, I am using of CDaoDatabase CDaoRecordset Classes and I want to know that How can I use SQL Commands by them? Like this(I want to have filter) "select * from Name where name='something'" and How can I Set a Field to an Edit Object? Best Wishes, Thanks.

    A 1 Reply Last reply
    0
    • Z Zero_One_ADO

      Hello, I am using of CDaoDatabase CDaoRecordset Classes and I want to know that How can I use SQL Commands by them? Like this(I want to have filter) "select * from Name where name='something'" and How can I Set a Field to an Edit Object? Best Wishes, Thanks.

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      the follwing piece of code might help you... CDaodatabase database; database.Create("C:\sample_log.mdb"); CString SqlCmd = "CREATE TABLE list (NAME VARCHAR(20), AGE INT, DATE VARCHAR(20), TIME VARCHAR(20));"; database.Execute(SqlCmd); database.Close(); now to search.... build a query string and execute it... CString query = "Select * from list where NAME='ABCD'" CDaoDatabase db; db.Open("C:\sample_log.mdb"); CDaoRecordSet record(&db); record.Open(AFX_DAO_USE_DEFAULT_TYPE,query,0); Then... while(!recor.IsEOF()) { ..... use GetFieldValue() for each record in the recordset } record.Close(); db.Close();

      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