能说的具体一些吗? try
{
_RecordsetPtr pRecordset;
CComVariant vtEmpty;
TCHAR charBuff[512];
wsprintf(charBuff,"Select * from Tbl_userInfo where AccountNum='%s'",OLE2T(AccountNum));
BSTR bstrSQL=A2BSTR(charBuff);
pRecordset = m_pConnection->Execute(bstrSQL,&vtEmpty, adCmdUnknown);
if(pRecordset->EndOfFile)
{
//返回值2代表这个用户没有注册
*result=2;
return hr;
}
_variant_t vBirthday;
vBirthday=pRecordset->GetCollect("DOB"); //这里应该怎么处理呀: }
catch(_com_error e)
{
char * strError=new char[64];
sprintf(strError,"错误:%s\n类型:%s",e.Description(),e.ErrorMessage());
MessageBox(NULL,strError,"error",MB_OK); }

解决方案 »

  1.   

    得到time_t后,可以参考下面函数:struct tm *localtime( const time_t *timer );tm中什么都有了!
      

  2.   

    怎样将“vBirthday”的值转为“time_t”呀!
      

  3.   

    选将取得的值赋到CString strTemp;
    再用下面的代码即可。
    strTemp = "2002-5-29"
    strTemp.TrimRight();
    if(strTemp!=_T(""))
    {
    COleDateTime otm;
    otm.ParseDateTime(strTemp);
    CTime tm(otm.GetYear(),otm.GetMonth(),otm.GetDay(),otm.GetHour(),otm.GetMinute(),otm.GetSecond());
    return tm;
    }
    else
    return 0;
      

  4.   

    我前面说了,project没有支持MFC
      

  5.   

    为什么我用下面的代码得出的结果总是:“1899年12月30日”
    求求各位:帮帮我(作揖)
    try
    {
    _RecordsetPtr pRecordset;
    CComVariant vtEmpty;
    TCHAR charBuff[512];
    wsprintf(charBuff,"Select * from Tbl_userInfo where AccountNum='%s'",OLE2T(AccountNum));
    BSTR bstrSQL=A2BSTR(charBuff);
    pRecordset = m_pConnection->Execute(bstrSQL,&vtEmpty, adCmdUnknown);
    if(pRecordset->EndOfFile)
    {
    //返回值2代表这个用户没有注册
    *result=2;
    return hr;
    } _variant_t   vBirthday; vBirthday=pRecordset->Fields->GetItem("DOB")->GetValue(); SYSTEMTIME sTIME;
    memset(&sTIME,0,sizeof(SYSTEMTIME));
    if(VariantTimeToSystemTime(vBirthday.date,
     &sTIME)==TRUE)
    {
    MessageBox(NULL,"OK","",MB_OK);
    } char tmpbuf[32];
    sprintf(tmpbuf,"%d年%d月%d日",sTIME.wYear,sTIME.wMonth,sTIME.wDay);
    MessageBox(NULL,(char*)tmpbuf,"",MB_OK); }
    catch(_com_error e)
    {
    char * strError=new char[64];
    sprintf(strError,"错误:%s\n类型:%s",e.Description(),e.ErrorMessage());
    MessageBox(NULL,strError,"error",MB_OK); }
      

  6.   

    你可以将variant转换成为_bstr_t,在强制转换成(char*)
      

  7.   

    试一下!
    _variant_t   vBirthday;
    vBirthday.vt=(VT_DATE);
    vBirthday=pRecordset->GetCollect("DOB");
    SYSTEMTIME sTIME;
    memset(&sTIME,0,sizeof(SYSTEMTIME));
    if(VariantTimeToSystemTime(vBirthday.date,&sTIME)==TRUE)
    {
    MessageBox(NULL,"OK","",MB_OK);
    }
    char tmpbuf[32];
    sprintf(tmpbuf,"%d-%d-%d",sTIME.wYear,sTIME.wMonth,sTIME.wDay);
    MessageBox(NULL,(char*)tmpbuf,"",MB_OK);