2014年3月29日15:02:17
MFC中使用ADO 插入Oracle,数据类型
建表语句
create table LWW_TEST (SN NUMBER primary key,CARDID VARCHAR2(25),MVLICENSE VARCHAR2(20),ENTRYTIME DATE)
代码:
try
{
CString sInsert;
CString str;
sInsert.Format(_T("insert into LWW_TEST(SN,CARDID,MVLICENSE,ENTRYTIME) values("));
str.Format(_T("%d,'"),aRec.m_nRecordNo);
sInsert+=str;
sInsert+=aRec.m_sCardID;
sInsert+=_T("','");
sInsert+=aRec.m_sMVlicense;
sInsert+=_T("','");
sInsert+=aRec.m_dtEntryTime.Format();
sInsert+=_T("')");
pCenterConnection->Execute((_bstr_t)sInsert,NULL,adCmdText);
}catch (_com_error &e)
{
CString sInfo;
sInfo.Format(_T("更新数据失败:%s"),e.ErrorMessage());
DBG_AfxMessageBox(sInfo);
exit(-1);
}