2 thoughts on “How To: Connect to a MySQL database using Connector/.NET in C#”

But going down this roll-your-own coding road should be avoided. You’ll end up with objects not being released properly, non standardised db access, vendor lock in (due to your code), etc. An example is not having dbConn.close() in your exception where you bomb out to the environment, you’ll likely have a connection still being used as they’re not always closed automatically for you.

Your readers may be interested in alternatives that are simpler to use for non-trivial projects.http://en.wikipedia.org/wiki/NHibernate
There is a penalty due to setup/configuration but it’s not too large, hence the non-trivial projects caveat. But the benefits are huge and it really is quite a spiffy project :)