当前位置: 代码迷 >> VC >> 初学.net连接数据库出错,
  详细解决方案

初学.net连接数据库出错,

热度:5914   发布时间:2013-02-25 00:00:00.0
初学.net连接数据库出错,求助。
private: System::Void button_Load_Click(System::Object^  sender, System::EventArgs^  e) {
 //连接数据库文件
 String ^ conStr = "Provider=Microsoft.Jet.OLEDB.4.0;Password="";User ID=Admin;Data Source=grocertogo.mdb";
 OleDbConnection con = gcnew OleDbConnection;
 con.ConnectionString = conStr;
 }
};



error C2664: “System::Data::OleDb::OleDbConnection::OleDbConnection(System::String ^)”: 不能将参数 1 从“System::Data::OleDb::OleDbConnection ^”转换为“System::String ^”
------解决方案--------------------------------------------------------
gcnew OleDbConnection;是什么东西,是OleDbConnection 类型还string类型
------解决方案--------------------------------------------------------
本来是想用 new OleDbConnection;的,但编译不过去,提示要用gcnew。
------解决方案--------------------------------------------------------
求助……求救助……
------解决方案--------------------------------------------------------
求助……求救助……
  相关解决方案