请贴出详细的代码,尽量详细,具体哈。我的级别很低,太专业了看不懂,呵呵

解决方案 »

  1.   

    参见
    http://topic.csdn.net/u/20080314/05/d79d0c40-947a-4dae-bef1-2c93d37631b5.html
      

  2.   

    CFinalApp::CFinalApp() 

    // TODO: add construction code here, 
    // Place all significant initialization in InitInstance 
    AfxOleInit(); 
    // CoInitialize(NULL); m_pConnection.CreateInstance(__uuidof(Connection)); 
    try 

    m_pConnection->Open("Provider=SQLOLEDB.1;Data Source=localhost;Initial Catalog=hotel","sa","sa",adConnectUnspecified); 

    catch(_com_error e) 

    AfxMessageBox("数据库连接失败!"); 
    PostQuitMessage(0); 

    } 看看