i am using asp.net on vb 2010 to build a website. my database is mysql. iam trying to add a new data source, when i select mysql, then i enter the name of the server, it closes the window by it self. then it tell me that .net framework data provider not available. it might not be installed.
please help me with it. it is very urgent.

I generally work with MSSQL but I worked on a project recently that had a back-end MySQL database hosted with a provider. All I had to do in my VS 2010 project is:

1) In the web.config file add this information:

<?xml version="1.0"?>
  <configuration>
    <connectionStrings>
    <!--MYSQL connection string-->
    <add name="mySQLConn" connectionString="Data Source=sqlserver.com;Database=dbName;User ID=uid;Password=pwd;" providerName="MySql.Data.MySqlClient"/>

     <!--MYSQL ODBC connection string-->
     <!--<add name="mySQLConn" connectionString="DRIVER={MySQL ODBC 3.51 Driver};SERVER=sqlserver.com;DATABASE=dbName;PORT=3306;USER=uid;PASSWORD=pwd;OPTION=3;" providerName="System.Data.Odbc" />-->
    </connectionStrings>

    <system.data>
       <DbProviderFactories>
           <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.4.4, Culture=neutral" />
       </DbProviderFactories>
    </system.data>

  </configuration>

2) As you can see above, I did not use the ODBC driver (its commented), so I had to add the correct version of a MySQL DLL to the BIN folder (mysql.data.dll). I download this file from the MySQL site. Then just refer to the connection string in my asp.net web pages/wizards. If you choose the ODBC, you dont need the .DLL file, but your provider needs to support that type of connection.

You cant directly connect to MySQL database using ADO.NET library. You need to download MySQL .NET connector to connect database. Connector/Net contains fully-managed ADO.NET driver for MySQL.

D/W Link: http://www.mysql.com/downloads/connector/net/

Connector has DLL(s) that you need to refer in your project.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.