能说的具体一些吗? 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); }
{
_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); }
再用下面的代码即可。
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;
求求各位:帮帮我(作揖)
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); }
_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);