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. COM
  4. problem in retrieving "Time" from database using _RecordsetPtr

problem in retrieving "Time" from database using _RecordsetPtr

Scheduled Pinned Locked Moved COM
databasemysqlcomhelpquestion
3 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.
  • P Offline
    P Offline
    PrafullaVedante
    wrote on last edited by
    #1

    Here i am developing a application which require to fetch Time from database . But i am getting 00:00:00 AM as a time everytime. We are using MySql database. Code fragment is.... ======================================================== _variant_t vtValue; vtValue = RsSession->Fields->GetItem("StartTime")->GetValue(); COleDateTime d( vtValue ); sprintf( name, "%02d:%02d:%02d",d.GetHour(),d.GetMinute(),d.GetSecond() ); ======================================================== in "name" i am getting "00:00:00" ..everytime.. All the other values i am retrieving from ResultSetPtr are OK. Can any one tell me what is to be done ther .... Thanks in advance Prafulla Vedante E-Mail : prafulla_v@asianitg.com

    B 1 Reply Last reply
    0
    • P PrafullaVedante

      Here i am developing a application which require to fetch Time from database . But i am getting 00:00:00 AM as a time everytime. We are using MySql database. Code fragment is.... ======================================================== _variant_t vtValue; vtValue = RsSession->Fields->GetItem("StartTime")->GetValue(); COleDateTime d( vtValue ); sprintf( name, "%02d:%02d:%02d",d.GetHour(),d.GetMinute(),d.GetSecond() ); ======================================================== in "name" i am getting "00:00:00" ..everytime.. All the other values i am retrieving from ResultSetPtr are OK. Can any one tell me what is to be done ther .... Thanks in advance Prafulla Vedante E-Mail : prafulla_v@asianitg.com

      B Offline
      B Offline
      BadJerry
      wrote on last edited by
      #2

      This is what I use: COleDateTime timField; _variant_t varValue; varValue.Clear(); varValue = m_pRecordset->Fields->GetItem(strFieldName)->GetValue(); if ( varValue.vt == VT_DATE ) //lint !e1036 !e569 { timField.m_dt = varValue.date; timField.SetStatus(COleDateTime::valid); } else timField.SetStatus(COleDateTime::null);

      P 1 Reply Last reply
      0
      • B BadJerry

        This is what I use: COleDateTime timField; _variant_t varValue; varValue.Clear(); varValue = m_pRecordset->Fields->GetItem(strFieldName)->GetValue(); if ( varValue.vt == VT_DATE ) //lint !e1036 !e569 { timField.m_dt = varValue.date; timField.SetStatus(COleDateTime::valid); } else timField.SetStatus(COleDateTime::null);

        P Offline
        P Offline
        PrafullaVedante
        wrote on last edited by
        #3

        sorry jerry but it doesent work at my side it still gives me 00:00:00 . Data type of "StartTime" in database is "time"

        Prafulla Vedante

        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