0

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.

4
Contributors
3
Replies
5
Views
5 Years
Discussion Span
Last Post by riteshbest
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.