none
problem in retrieving "Time" from database using _RecordsetPtr

    Question

  •  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

     

    Saturday, September 09, 2006 1:13 PM

Answers

  • Using the debugger, see if vtValue appears to be receiving the right time.  If it is not, I would find a forum specific to MySql.  If it is, post here the contents of vtValue.

    Brian

    Saturday, September 09, 2006 5:01 PM

All replies

  • Using the debugger, see if vtValue appears to be receiving the right time.  If it is not, I would find a forum specific to MySql.  If it is, post here the contents of vtValue.

    Brian

    Saturday, September 09, 2006 5:01 PM
  • hello brian
       i have tested vtValue in debug mode.
     Value i got is {16/09/2006 00:00:00 AM VT_DATE }

     i am not getting correct value of time ...

    Saturday, September 16, 2006 5:05 AM
  • This is a C++ language forum.  I would find the MySql forum and discuss it with them--they are more likely to say "ah-ha, I know what your problem is, you need to tell the sys admin recompile MySql, etc etc"

     

    Saturday, September 16, 2006 2:35 PM
  • Why aren't you using the function

    "VariantTimeToSystemTime"

    to extract date and time both  ?

    Header : oleauto.h.

    Library : oleaut32.lib.

     

    Monday, September 18, 2006 7:11 AM
  • He's getting the correct date, but not the correct time.  Why do you think VariantTimeToSystemTime would fix this?
    Monday, September 18, 2006 1:21 PM