retreive a date from a ADO database
-
hi, i'm using ado to connect to my database. now i want to retreive a date from the _RecordsetPtr. how do i do this? I also want to do this with a Currency... my code:
COleDateTime Date; Date = (????) pRecordset->Fields->GetItem("Date")->Value;
[]D [] []D [] -
hi, i'm using ado to connect to my database. now i want to retreive a date from the _RecordsetPtr. how do i do this? I also want to do this with a Currency... my code:
COleDateTime Date; Date = (????) pRecordset->Fields->GetItem("Date")->Value;
[]D [] []D []Personally, I use the function VariantTimeToSystemTime to convert the returned VARIANT_T into a SYSTEMTIME structure which can then be used by COleDateTime. Michael Wonder Woman, Wonder Woman. All the world's waiting for you, and the power you possess. In your satin tights, Fighting for your rights And the old Red, White and Blue.
-
Personally, I use the function VariantTimeToSystemTime to convert the returned VARIANT_T into a SYSTEMTIME structure which can then be used by COleDateTime. Michael Wonder Woman, Wonder Woman. All the world's waiting for you, and the power you possess. In your satin tights, Fighting for your rights And the old Red, White and Blue.
-
hi, i'm using ado to connect to my database. now i want to retreive a date from the _RecordsetPtr. how do i do this? I also want to do this with a Currency... my code:
COleDateTime Date; Date = (????) pRecordset->Fields->GetItem("Date")->Value;
[]D [] []D []You can build a
COleDateTime
from a_variant_t
, the type that is returned frompRecordset->Fields->GetItem("Date")->Value
. So, your code could look like:COleDateTime Date(pRecordset->Fields->GetItem("Date")->Value);
-
Personally, I use the function VariantTimeToSystemTime to convert the returned VARIANT_T into a SYSTEMTIME structure which can then be used by COleDateTime. Michael Wonder Woman, Wonder Woman. All the world's waiting for you, and the power you possess. In your satin tights, Fighting for your rights And the old Red, White and Blue.
-
You can build a
COleDateTime
from a_variant_t
, the type that is returned frompRecordset->Fields->GetItem("Date")->Value
. So, your code could look like:COleDateTime Date(pRecordset->Fields->GetItem("Date")->Value);
-
this might sound stupid, but it doesn't seem to work... my code:
_RecordsetPtr pRecordset; LPSYSTEMTIME time; VariantTimeToSystemTime((double)pRecordset->Fields->GetItem("Datum")->Value, time);
:omg::omg::omg: It crashes.... []D [] []D []That will be because "time" points somewhere invalid/undefined. Try SYSTEMTIME time; VariantTimeToSystemTime((double)pRecordset->Fields->GetItem("Datum")->Value,&time); That will work, unless the date/time stored is NULL. Steve S [This signature space available for rent]