_ConnectionPtr m_pConnection;
m_pConnection.CreateInstance(__uuidof(Connection));
问题来了:
m_pConnection->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\DWJ\My Documents\Visual Studio 2008\Projects\AAA\student.mdb","","",NULL);//用Jet数据库引擎对数据库进行连接
m_pConnection->Open("Data Source=student;UID=sa;PWD=;","","",NULL);//用ODBC数据源;
为什么用第一个open函数连不上数据库,用第二个open函数可以呢??????
------解决方案--------------------------------------------------------
改为:
m_pConnection->Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Documents and Settings\\DWJ\\My Documents\\Visual Studio 2008\\Projects\\AAA\\student.mdb","","",NULL);//用Jet数据库引擎对数据库进行连接
试一下