连接数据库的时候出现错误 ConnectionString 中未指定 OLE DB 提供程序
我是这样连接的 static string strConn = "Data Source=.;Initial Catalog=mydb;User ID=sa;password=8736355";
SqlConnection con = new SqlConnection(connStr);
SqlDataAdapter da = new SqlDataAdapter();
DataTable DT = new DataTable();
代码是string mySelectQuery = "SELECT 温度, 湿度 FROM hjb;";
OleDbConnection myConnection = new OleDbConnection(strConn);
OleDbCommand myCommand = new OleDbCommand(mySelectQuery, myConnection);
myCommand.Connection.Open();
OleDbDataReader myReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
chart1.DataBindTable(myReader, "温度");
myReader.Close();
myConnection.Close();
就出现了如题的错误 小弟新手 我是想为chart控件绑定一个数据表 显示曲线图 谢谢大侠 小弟急用 谢谢
------解决方案--------------------
<add key="strConnection" value="server=(local);DATABASE=TEST;uid=sa;pwd=sa;Provider=SQLOLEDB;" />