The secret to accessing databases from within the .NET environment lies in finding the right data provider. Although a generic OleDb provider is included with VS.NET, because it is indeed generic, it tends to offer only the plainest-vanilla, least powerful forms of data access and manipulation capabilities. To get access to database features specific to particular database engines, it's necessary to find a data provider that delivers access to those features. For the popular Open Source MySQL database, Core Lab's MySQLDirect .NET Data Provider is an attractive, highly functional, and inexpensive ($99) tool (the company also offers data providers for Oracle, PostgresSQL and SQL Server databases as well).
MySQLDirect .NET works just like the Microsoft OleDb and SQLServer data providers for VS.NET, and is built entirely around ActiveX Data Objects for the .NET Framework, or ADO.NET. Thus, the implementation also provides access to data in relational, XML, or application-specific forms. On the MySQL side, this product uses a native MySQL programming interface to provide direct, straightforward access to MySQL databases.
The structure and vernacular of building applications with this tool is simple and familiar. MySQLDirect .NET provides MySqlConnection objects to attach to MySQL databases, MySqlCommand for SQL commands and operations, MySqlDataReader to manipulate database results, and MySqlDataAdapter, which populates a DataSet and resolves updates with a target MySQL database. This makes it easy to recycle code written to the OleDb provider, in that you must add a reference to your specific project, add a Use statement for the MySQL provider namespace and replace old generic calls with new specific ones. This permits near-automatic translation of existing code, and makes it easy to write new code as well. The product also includes numerous other classes to customize commands, handle exceptions, monitor dynamic SQL execution, manage input, output, return value parameters for commands and more.
MySQLDirect .NET also permits direct access to and manipulation of database data, but also supports the ADO.NET DataSet for disconnected processing, and later reconciliation with a MySQL database if necessary. The code is lightweight, simple, and compact which permits ready access to MySQL capabilities without slowing things down.
To install the MySQLDirect .NET Data Provider, the .NET Framework must already be installed on the computer. Likewise, the MySQL client library (libmysql.dll) must also be available to the runtime environment. For all that, the tool is simple, powerful, and easy to use. Definitely worth a look-see.
Ed Tittel is a principal at LANWrights, Inc. a wholly-owned subsidiary of iLearning.com, where he writes and teaches on a variety of subjects, including markup languages, development tools, and IT certifications. Contact Ed via e-mail at firstname.lastname@example.org.