M micksxb Unregistered / Unconfirmed GUEST, unregistred user! 2004-04-02 #1 我建好了一个数据库,可是我不知道怎么用CDatabase对象和数据库建立连接啊?请大侠指教! 比如我要为我的数据库添加一个元组,我要怎么办呢?
A amli Unregistered / Unconfirmed GUEST, unregistred user! 2004-04-05 #4 //#include <afxdb.h> void CDatabaseDlg::OnButton1() { CDatabase m_db; try { if (m_db.OpenEx( "DRIVER=SQL Server;UID=sa;Network=DBNMPNTW;WSID=.;APP=Microsoft Open Database Connectivity;SERVER=.", CDatabase::noOdbcDialog ) ) { ::AfxMessageBox( "Suff" ); m_db.Close(); } } catch(...) { if ( !m_db.IsOpen() ) ::AfxMessageBox("Error"); } }
//#include <afxdb.h> void CDatabaseDlg::OnButton1() { CDatabase m_db; try { if (m_db.OpenEx( "DRIVER=SQL Server;UID=sa;Network=DBNMPNTW;WSID=.;APP=Microsoft Open Database Connectivity;SERVER=.", CDatabase::noOdbcDialog ) ) { ::AfxMessageBox( "Suff" ); m_db.Close(); } } catch(...) { if ( !m_db.IsOpen() ) ::AfxMessageBox("Error"); } }