Bruno Montebelo
Bruno Montebelo

Reputation: 190

Cannot obtain provider factory for data provider named MySql.Data.MySqlClient

I have Windows 8.1, MySql 5.6, and Visual Studio Ultimate 2012.

I am trying to set a DataSet, but I am having the error Cannot obtain provider factory for data provider named MySql.Data.MySqlClient when I try to drag a table to the DataSet.

a) The Server Explorer can access the database and show me all tables, and the "Test Connection" button returns a successful message.

b) I added MySql references to the bin folder (MySql.Data, MySql.Data.Entity, MySql.Web).

c) I edited the Web.config file removing MySql.Data.MySqlClient invariant and adding it again with "correct" settings. I tried to set <connectionStrings>, <DbProviderFactories>, membership providers, profile providers, and RoleManager providers;

d) I have already uninstalled and reinstalled MySql and Visual Studio.

Nothing seems to work, and the same error remains happening. I have already tried a lot of suggestions from this and other forums.

Upvotes: 9

Views: 18886

Answers (4)

LouEllen
LouEllen

Reputation: 11

C4U gave me the clue I needed after fighting with this all day. Connector/Net seemed to install with MySQL for Visual Studio when I used the installer the first time. I could create a connection in the Server Explorer but couldn't create a new connection from within my project. I also couldn't run the little blue button (MySQL Website Configuration). I tried rerunning the installer and couldn't find Connector/Net. It had not installed completely.
What worked: I closed Visual Studio and opened Programs and Features from the Control panel and uninstalled ALL MySql Connector programs, including Connector/Net. Then I reran the same MySql Visual Studio Installer I had run before and, voila!, I could see the Connector/Net and install it. Then I opened Visual Studio, deleted my connections, and clicked on the little blue button (MySQL Website Configuration). Worked! I could also create a connection inside my project. AND I didn't have to add ANY reference or ANYTHING to the config file.

Upvotes: 0

n00dl
n00dl

Reputation: 61

Worked for me, steps below:

  • Close Visual Studio
  • Run the MySQL Connector/Net and remove your installation
  • Run the Connector again and install as you have done prior to deletion(typical/custom).
  • Open Visual studio
  • Delete all connections to server/database/dataset from the solution and server explorer. Do not remove any lines of code.
  • Re-establish a connection to your database,naming it as it was.
  • Re-establish a connection to your data source for data set as it was.
  • Click play, be happy!

Hope this helps.

Upvotes: 6

Make sure you have installed "Connector/NET" and "MySQL for Visual Studio". Run "MySQL Installer" and install those two.

Upvotes: 1

Basel Jerjawi
Basel Jerjawi

Reputation: 56

you have to install mysql connector just download the last version of MySql connector and install it while closing visual studio

Upvotes: 3

Related Questions