日期:2014-05-16 浏览次数:20549 次
VC:
CString strConnectAcc,strConnectSql;
//strConnect.Format(_T("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s"), strMdbFile);
//strConnect.Format(_T("Microsoft.Jet.OLEDB.4.0;Data Source=%s;Persist Security Info=False;Jet OLEDB:Database Password='%s'"), strMdbFile,"xxxxxx");
strConnectAcc.Format(_T("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;Persist Security Info=False;Jet OLEDB:Database Password=xxxxx"),strMdbFile);
try
{
m_pConnectionAcc.CreateInstance(__uuidof(Connection));
m_pConnectionAcc->Open(_bstr_t(strConnectAcc), _bstr_t(), _bstr_t(), adModeUnknown);
m_pRecordsetAcc.CreateInstance(__uuidof(Recordset));
}
catch (_com_error e)
{
//AfxMessageBox("ConDateBaseError:"+e.Description());
return false;
}
TADOConnection——Microsoft Jet 4.0 OLE DB Provider——连接数据源(据说用分享的方式就可以实现分布式啦)——空白密码——所有——Database,
后面你懂的。。。