Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 552
user3216175 Avatar asked Jan 20 '14 18:01

user3216175


2 Answers

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.

like image 73
n00dl Avatar answered Sep 19 '22 12:09

n00dl


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

like image 23
Basel Jerjawi Avatar answered Sep 16 '22 12:09

Basel Jerjawi