我在建立Connection对象Command对象Recordset对象和数据库连接时,说未指定的错误。应该怎么改呀,我用的是SQL

解决方案 »

  1.   

    在Connection对象中
    _bstr_t strConnect="Provider=SQLOLEDB.1;Password=sa;Persist Security Info=True;User ID=sa;Initial Catalog=UserMan;Data Source=localhost;";
    这句中的Persist Security Info=True;表示什么意思
    在Command对象中
    UpdataData(TRUE);是什么意思
    在Recordset对象中
    m_pRecordset.CreateInstance(__uuidof(Recordset));是创建的怎样的一个Recordset啊
      

  2.   

    这句中的Persist Security Info=True;表示什么意思
    -->每次连接时都要输入密码
      

  3.   

    Persist Security Info=True
    连接时密码验证属性,不要也没关系,会取默认的。UpdataData(TRUE) 是dataset把数据交给后台表的一个方法。3创建在指定程序集中定义的指定类型的新实例
      

  4.   

    我在建立Connection对象Command对象Recordset对象和数据库连接时,说未指定的错误。应该怎么改呀,我用的是SQL 
      

  5.   

    string strCon="server=192.168.1.1;database=mybase;uid=sa;pwd=sa";
      

  6.   


    (1)连接数据库 
    HRESULT hr; 
    try 

    _variant_t RecordsAffected; 
    hr = m_pConnection.CreateInstance("ADODB.Connection");///创建Connection对象 
    if(SUCCEEDED(hr)) 

    hr = m_pConnection->Open("DSN=test;UID=;PWD=;","","",adModeUnknown);///连接数据库 


    catch( _com_error e)///捕捉异常 

    CString errormessage; 
    errormessage.Format("连接数据库失败!\r\n错误信息:%s",e.ErrorMessage()); 
    AfxMessageBox(errormessage);///显示错误信息 

      

  7.   

    这个是SQL测试连接的语句啊,先在DBMS里面测试连接是否成功,在把语句放到程序代码中