An OLE DB Provider was not specified in the ConnectionString. 'Provider=SQLOLEDB;

匿名 (未验证) 提交于 2019-12-03 01:14:02

问题:

i trying to run query using C#, i am getting the following problem

An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;

my code

string strConString = System.Configuration.ConfigurationManager.ConnectionStrings["WorkflowConnStr"].ConnectionString.ToString();  string sqlstr = "select * from table"         OleDbConnection myConnection = new OleDbConnection(strConString); try      {myConnection.Open();} catch (Exception err)       { System.Diagnostics.Debug.WriteLine(err.Message); }  OleDbCommand myCommand = new OleDbCommand(sqlstr, myConnection); OleDbDataReader reader = myCommand.ExecuteReader(); 

web.config

any suggestion ?

回答1:

Try adding this to your connection string,

Provider=SQLNCLI10.1 

So it would be;



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!