我在Open中指定密码,可就是不能连接.

解决方案 »

  1.   

    CString sServerName;
    CString sLoginName;
    CString sPassword;sServerName = "(local)";
    sLoginName = "sa";
    sPassword = "";连接SQL,HRESULT hr;
    hr = psqlserver->Connect(_variant_t(sServerName),_variant_t(sLoginName),_variant_t(sPassword);连接Access:
    CString sDBPath="E:\\Database\\";
    CString sConnection.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%sExample.mdb;Persist Security Info=False;Jet OLEDB:Database Password=dj02520820;",sDBPath);
    HRESULT hr;
    hr=m_pConnection->Open(_bstr_t(sConnection),_bstr_t(""),_bstr_t  (""),-1);