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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. DATABASE PROBLEM

DATABASE PROBLEM

Scheduled Pinned Locked Moved C / C++ / MFC
databasehelp
4 Posts 4 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.
  • F Offline
    F Offline
    Fawaz Ajani
    wrote on last edited by
    #1

    Hi all! I have a serious problem with DATETIME in SELECT. This is my code:

    CRecordset recordset(&database);
    CString query;
    // m_tabOnglet[0] is a Dialog
    m_tabOnglet[0]->GetDlgItemTextW(IDC_DATETIMEPICKER1, datNaiss);
    query.Format(L"SELECT numFROM personne WHERE datNais = '%s'", datNaiss);
    recordset.Open(CRecordset::snapshot, query);

    When I run the debbuger, it show message like this: "incompatible data type in criteria expression"

    F S D 3 Replies Last reply
    0
    • F Fawaz Ajani

      Hi all! I have a serious problem with DATETIME in SELECT. This is my code:

      CRecordset recordset(&database);
      CString query;
      // m_tabOnglet[0] is a Dialog
      m_tabOnglet[0]->GetDlgItemTextW(IDC_DATETIMEPICKER1, datNaiss);
      query.Format(L"SELECT numFROM personne WHERE datNais = '%s'", datNaiss);
      recordset.Open(CRecordset::snapshot, query);

      When I run the debbuger, it show message like this: "incompatible data type in criteria expression"

      F Offline
      F Offline
      Freak30
      wrote on last edited by
      #2

      Possibly the content of the DateTimePicker is not a string and can't be formated that way. Also it may be a problem that you are missing a space in front of the FROM in the query.

      The good thing about pessimism is, that you are always either right or pleasently surprised.

      1 Reply Last reply
      0
      • F Fawaz Ajani

        Hi all! I have a serious problem with DATETIME in SELECT. This is my code:

        CRecordset recordset(&database);
        CString query;
        // m_tabOnglet[0] is a Dialog
        m_tabOnglet[0]->GetDlgItemTextW(IDC_DATETIMEPICKER1, datNaiss);
        query.Format(L"SELECT numFROM personne WHERE datNais = '%s'", datNaiss);
        recordset.Open(CRecordset::snapshot, query);

        When I run the debbuger, it show message like this: "incompatible data type in criteria expression"

        S Offline
        S Offline
        SujayG
        wrote on last edited by
        #3

        "

        When I run the debbuger, it show message like this:
        "incompatible data type in criteria expression

        " Exactly in which line does show By the naming convention

        m_tabOnglet

        looks like a member variable of a tabcontrol.

        My Blog

        1 Reply Last reply
        0
        • F Fawaz Ajani

          Hi all! I have a serious problem with DATETIME in SELECT. This is my code:

          CRecordset recordset(&database);
          CString query;
          // m_tabOnglet[0] is a Dialog
          m_tabOnglet[0]->GetDlgItemTextW(IDC_DATETIMEPICKER1, datNaiss);
          query.Format(L"SELECT numFROM personne WHERE datNais = '%s'", datNaiss);
          recordset.Open(CRecordset::snapshot, query);

          When I run the debbuger, it show message like this: "incompatible data type in criteria expression"

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

          Using the debugger, what is the value of query?

          "One man's wage rise is another man's price increase." - Harold Wilson

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

          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