Solved

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

Posted on 2014-04-20
7
2,906 Views
Last Modified: 2014-04-26
Hi Experts,
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;'

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();

Open in new window


web.cofig
  <connectionStrings>
  <add name="WorkflowConnStr" connectionString="Data Source=MOFSQL08R2-PROD;Initial Catalog=Workflow;user id=AdobeLCES2_User;password=WFProd2010" providerName="System.Data.OleDb.OleDbConnection"  />
  </connectionStrings>

Open in new window


any suggestion ?
0
Comment
Question by:AZZA-KHAMEES
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 13

Expert Comment

by:Koen Van Wielink
ID: 40012084
Have you tried removing the "providerName=....." portion from the web.config?
0
 

Author Comment

by:AZZA-KHAMEES
ID: 40012087
yes tried that but still the same error
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 40012311
It means what it says; you haven't specified what OLE DB provider to use. If it's a SQL Server it would be SQLOLEDB.1, as in:
  <connectionStrings>
  <add name="WorkflowConnStr" connectionString="Provider=SQLOLEDB.1;Data Source=MOFSQL08R2-PROD;Initial Catalog=Workflow;user id=AdobeLCES2_User;password=WFProd2010" providerName="System.Data.OleDb.OleDbConnection"  />
  </connectionStrings>

Open in new window

0
Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

 
LVL 34

Expert Comment

by:ste5an
ID: 40012313
Looks like you're connecting to a SQL Server, so why do you use OleDbCommand instead of SqlCommand?

See also Store connection string in web.config.
0
 

Accepted Solution

by:
AZZA-KHAMEES earned 0 total points
ID: 40012332
thank you all for the replies
solved the issues by adding Provider=SQLNCLI11 to the connection string

<add name="WorkflowConnStr" connectionString="Data Source=Server;Initial Catalog=DBName;user id=usr;password=password;Provider=SQLNCLI11" providerName="System.Data.OleDb.OleDbConnection"/>

Open in new window

0
 
LVL 13

Expert Comment

by:Koen Van Wielink
ID: 40014092
Shouldn't points be awarded to Carl? He basically gave the answer.
0
 

Author Closing Comment

by:AZZA-KHAMEES
ID: 40024362
found solution from different forum
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
array not updating 8 42
CSS question 16 63
RestClient.cs fails at (HttpWebResponse)request.GetResponse()) 4 53
Web Site Administration Tool - Security Questions 2 39
'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question