.MDB文件,CDataSource 连接,如何设置密码?? 主要是不知道如何设置.mdw信息文件?各位高手指教一下CDBPropSet的属性设置之前如何设置.mdw的相关信息。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我也在学习CDataSource的问题,帮你up CDataSource db; CSession session; HRESULT hr; CDBPropSet dbinit[2]; dbinit[0].SetGUID(DBPROPSET_DBINIT); //Set Jet OLE DB provider specific properties dbinit[1].SetGUID(DBPROPSET_JETOLEDB_DBINIT); dbinit[0].AddProperty(DBPROP_AUTH_CACHE_AUTHINFO, true); dbinit[0].AddProperty(DBPROP_AUTH_ENCRYPT_PASSWORD, false); dbinit[0].AddProperty(DBPROP_AUTH_MASK_PASSWORD, false); dbinit[0].AddProperty(DBPROP_AUTH_PASSWORD, "password1"); dbinit[0].AddProperty(DBPROP_AUTH_USERID, "user1"); dbinit[0].AddProperty(DBPROP_INIT_DATASOURCE, "C:\\test.mdb"); dbinit[0].AddProperty(DBPROP_INIT_MODE, (long)16); dbinit[0].AddProperty(DBPROP_INIT_PROMPT, (short)4); dbinit[0].AddProperty(DBPROP_INIT_PROVIDERSTRING, ";COUNTRY=0;CP=1252;LANGID=0x0409"); dbinit[0].AddProperty(DBPROP_INIT_LCID, (long)1033); dbinit[0].AddProperty(DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO, false); //Database password dbinit[1].AddProperty(DBPROP_JETOLEDB_DATABASEPASSWORD, "Demo"); //System database dbinit[1].AddProperty(DBPROP_JETOLEDB_SYSDBPATH, "C:\\winnt\\system32\\system.mdw"); hr = db.OpenWithServiceComponents("Microsoft.Jet.OLEDB.4.0", dbinit,2); if (FAILED(hr)) return hr; hr = session.Open(db); if (FAILED(hr)) return hr; CDBPropSet propset(DBPROPSET_ROWSET); propset.AddProperty(DBPROP_CANFETCHBACKWARDS, true); propset.AddProperty(DBPROP_IRowsetScroll, true); propset.AddProperty(DBPROP_IRowsetChange, true); propset.AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE ); 请教如何写sql代码(学校作业) windows2003自带防火墙+sqlserver2008觉得有BUG XMLA 是什么东东? 存储过程返回时间的问题 每一分钟访问一次数据库,效率问题 数据查询的问题 向高手求一SQL语句。 sql server 2000 (中简)登陆出错问提(200分) 扩展存储过程的DLL怎么做? 怎么能实现每条记录对应加两行空行 关于锁的问题,帮帮我!谢谢! 关于导数据的问题,急!
CSession session;
HRESULT hr;
CDBPropSet dbinit[2];
dbinit[0].SetGUID(DBPROPSET_DBINIT);
//Set Jet OLE DB provider specific properties
dbinit[1].SetGUID(DBPROPSET_JETOLEDB_DBINIT); dbinit[0].AddProperty(DBPROP_AUTH_CACHE_AUTHINFO, true);
dbinit[0].AddProperty(DBPROP_AUTH_ENCRYPT_PASSWORD, false);
dbinit[0].AddProperty(DBPROP_AUTH_MASK_PASSWORD, false);
dbinit[0].AddProperty(DBPROP_AUTH_PASSWORD, "password1");
dbinit[0].AddProperty(DBPROP_AUTH_USERID, "user1");
dbinit[0].AddProperty(DBPROP_INIT_DATASOURCE, "C:\\test.mdb");
dbinit[0].AddProperty(DBPROP_INIT_MODE, (long)16);
dbinit[0].AddProperty(DBPROP_INIT_PROMPT, (short)4);
dbinit[0].AddProperty(DBPROP_INIT_PROVIDERSTRING, ";COUNTRY=0;CP=1252;LANGID=0x0409");
dbinit[0].AddProperty(DBPROP_INIT_LCID, (long)1033);
dbinit[0].AddProperty(DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO, false); //Database password
dbinit[1].AddProperty(DBPROP_JETOLEDB_DATABASEPASSWORD, "Demo");
//System database
dbinit[1].AddProperty(DBPROP_JETOLEDB_SYSDBPATH, "C:\\winnt\\system32\\system.mdw"); hr = db.OpenWithServiceComponents("Microsoft.Jet.OLEDB.4.0", dbinit,2);
if (FAILED(hr))
return hr; hr = session.Open(db);
if (FAILED(hr))
return hr; CDBPropSet propset(DBPROPSET_ROWSET);
propset.AddProperty(DBPROP_CANFETCHBACKWARDS, true);
propset.AddProperty(DBPROP_IRowsetScroll, true);
propset.AddProperty(DBPROP_IRowsetChange, true);
propset.AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE );