Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2014-04-20
7
Medium Priority
?
3,061 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 35

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

AWS Certified Solutions Architect - Associate

This course has been developed to provide you with the requisite knowledge to not only pass the AWS CSA certification exam but also gain the hands-on experience required to become a qualified AWS Solutions architect working in a real-world environment.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

704 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