Link to home
Start Free TrialLog in
Avatar of greenbird
greenbird

asked on

Urgent!!!! strange! how to CORRECTLY use GetFieldValue(str)?

Hi,

 i have a database file a.mdb, it has a field named "DOB" whose data type is "date/time". now i wnat to get the value of this field for a record:

 COlevariant v1;
 char *s1=(char *)malloc(10*sizeof(char));

 v1=rs.GetFieldValue("DOB");
 s1=(char *)v1.bstrVal;

 however i can not get the value! if i change the data type to "text", then can get it (say 29/10/99).
 any one knows how to get the field value with date/time data type?

 Pls help! thanks a lot!
Avatar of MDarling
MDarling

try casting to COleDateTime and using
that classes member functions.

regards,
mike.
ASKER CERTIFIED SOLUTION
Avatar of Toronado
Toronado

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
CDaoRecordset* m_UserRecordSet;

//initializing m_UserRecordSet
....
....

//getting date/time
COleDateTime odt;
odt = m_UserRecordSet->GetFieldValue("DOB");

//COleDateTime = more functionality that CTime