数据库

img bohut

读写SQL+ADO的datetime

发表于2004/10/29 14:30:00  1112人阅读

COleDateTime oleDate = COleDateTime::GetCurrentTime();
_variant_t vtFld;
vtFld.vt = VT_DATE;
vtFld.date = oleDate;
pRecordSet4->PutCollect("date", vtFld);

读时间值
_bstr_t TheValue=m_pset->Fields->GetItem("出生年月")->Value;
temp=(char *)TheValue;
COleVariant vtime(temp);
vtime.ChangeType(VT_DATE);
COleDateTime time4=vtime;//读出的是COleDateTime

用下面的方法转换
COleDateTime time1(1977,4,16,2,2,2); //COleDataTime--->CTime
SYSTEMTIME systime;
VariantTimeToSystemTime(time1, &systime);
CTime tm(systime);

阅读全文
0 0

相关文章推荐

img
取 消
img