MySql with .Net SqlDataSource on hosted server
I was getting an error saying the .Net provider could not be found when attempting to connect to a MySql db in hosted environment. If the MySql.Data.MySqlClient is not loaded in the GAC on the hosted server, you will need to add a reference in your web.config, if you want to use the SqlDataSource control.
web.config - make sure the version matches your MySqlClient version
<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=5.2.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
SqlDataSource reference
<asp:SqlDataSource ProviderName="MySql.Data.MySqlClient" ID="dsData" runat="server" ></asp:SqlDataSource>
- Download this code: MySqlRemote.txt
Trackback URI |