|
马上注册登录,享用更多网站功能!
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
各位高手,
我用ADO动态建立ACESS表时,为什么只能建四列,到了第五列,编译连接都可以,一用UG调用就不行了,出错,为什么啊?谁有解决方案?
程序:
_ConnectionPtr m_pConnection;
m_pConnection.CreateInstance("ADODB.Connection");
m_pConnection->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\project\\base\\mingxi\\mingxibiao.mdb","","",adModeUnknown);
_RecordsetPtr m_pRecordset;
_variant_t RecordsAffected;
m_pConnection->Execute("CREATE TABLE 3_g_01(ID INTEGER NOT NULL,partname TEXT,attribute INTEGER)",
&RecordsAffected,adCmdText);
m_pConnection->Execute("ALTER TABLE 3_g_01 ADD count INTEGER",&RecordsAffected,adCmdText);
m_pRecordset.CreateInstance("ADODB.Recordset");
m_pRecordset->Open("SELECT * FROM 3_g_01",_variant_t((IDispatch *)m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText);
m_pRecordset->AddNew();///添加新记录
m_pRecordset->PutCollect("ID",_variant_t(long(1)));
m_pRecordset->PutCollect("partname",_variant_t("157.74.01.01c"));
m_pRecordset->PutCollect("attribute",_variant_t(long(450)));
m_pRecordset->PutCollect("count",_variant_t(long(1)));
m_pRecordset->Update();
m_pRecordset->Close();//关闭记录集
m_pConnection->Close();//关闭连接 |
|