Today I had an opportunity to travel back in time all the way to 2005 and work with the classic ADO.NET classes in .NET. Needless to say, I’d forgotten everything about it…
The end goal was to create a control that can connect to different databases, even different types of databases, and execute the same SQL commands based on some condition. Basically it was, at last, that real-world scenario all the ASP.NET and C# books from back in the day said just might come up some day. It only took 8 years!
Anyway, my first step was to verify that I did indeed have all my data providers in the ADO.NET DbFactories, as I needed to cover SQL Server, Oracle, and MySQL. Fortunately I quickly found this old developer.com article which laid it out for me.
When I ran that, I noticed that the MySql provider was missing, which was unexpected because I did have the MySql.Data assembly (which contains the MySql .Net Connector) in my project. After a bit more searching I found this helpful StackOverflow thread: ASP.NET and MySQL .Net Framework Data Provider Issues.
It reminded me that I also have to add that Provider to the system.data node in web.config, as shown here:
Once I added that to my web.config, I was able to see it in the list of providers above.
Now I’m ready to rock!