As I was putting together a simple web application with asp.net and mysql, I ran into a mysterious and misleading error that went something like:
Failed to generate code. Exception of type 'System.Data.Design.InternalException' was thrown.
Oddly enough, the error pointed to the first line of my DAL DataSet.xsd where the XML declaration resides. It turns out, this is not a parsing error at all, but rather an issue with the .NET compiler being unable to auto-generate the C# code from the DataSet's XML. The reason being, it couldn't find the appropriate DbProviderFactory. The solution was pretty simple in the end. All I had to do was add the following SQL DB Provider to my web.config and I was on my way.
<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.0.4.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D" />
</DbProviderFactories>
</system.data>
No comments:
Post a Comment