vc6.0利用ADO连接SqlServer2000失败
/*已经在在stdAfx.h文件中添加#import "C:\Program Files\Common Files\System\ADO\msado15.dll" no_namespace \rename("EOF","adoEOF") rename("BOF","adoBOF")连接本地的数据库。数据库名为membership;*/ _ConnectionPtr m_pconnection; if(!AfxOleInit())//这就是初始化COM库 { AfxMessageBox("OLE初始化出错!"); return FALSE; } m_pconnection.CreateInstance(_uuidof(Connection)); try { //这有问题吗 _bstr_t SqlConnection="driver=SQLOLEDB;Sever=LocalServer;DATABASE=membership;UID=sa;PWD=123456";// m_pconnection->Open(SqlConnection,"","",adModeUnknown); } catch(_com_error e) { AfxMessageBox("Failed"); return FALSE; } AfxMessageBox("Successful"); return TRUE;CString strConn ="Provider=SQLOLEDB;Server=192.168.xxx.xxx;DATABASE=membership; UID=sa;PwD=123456;";