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);
}

本文介绍如何在MFC应用程序中使用ADO技术实现对Oracle数据库的操作,具体演示了插入数据的方法。通过构造SQL语句并利用ADO接口执行,文章详细展示了插入数据的具体步骤和注意事项。
307

被折叠的 条评论
为什么被折叠?



