Solved

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

Posted on 2014-04-20
7
2,683 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
7 Comments
 
LVL 12

Expert Comment

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

Author Comment

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

Expert Comment

by:Carl Tawn
Comment Utility
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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 32

Expert Comment

by:Stefan Hoffmann
Comment Utility
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
Comment Utility
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 12

Expert Comment

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

Author Closing Comment

by:AZZA-KHAMEES
Comment Utility
found solution from different forum
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now