MySQL and .NET


VB.NET Forum Admin
Jun 3, 2004
Programming Experience
Anyone done any work with MySQL as a backend for a .NET app? If so, what tools did you use, what was the experience, etc.?
I currently work with VB.NET and ASP.NET (using VB) with a MySql backend. I started to use the Free version of the CoreLabs dataprovider, but it had an 8 field limit in the free version. I then moved to the ByteFx ( data provider. It was free and being activly worked on for improvements. It has since been picked up by MySQL AB and is being made the offical .NET Data Provider ( I have not attempted to use the new version since it is being released by MySQL (with the same original developer doing the work), but I am getting ready to start a new project and plan to make use of it.

VB.NET with MySQL 4.1.9

Hi, i'm a beginner with the .net framework, but i'm trying to connect my app with mysql using the conector mysql-connector-net-1.0.4 but i dont know how i must configure it to get it work, could somebody help me please :(

by the way, i'm using Visual Studio NET 2002
Something to note with MySQL is that unless you buy the Corp. version you must make your code open source.

Here is how I do it.

1. Add a referece to the component in the project.

2. Import the name space:
Imports MySql.Data.MySqlClient

3. I make my Connection string available to all code in my class:
CONST CONNECTION_STRING As String = "Data Source=servername;database=dbName;user ID=username;password=password"

4. Procedure to return DataSet:
Private Function GetOrdersAndDetails() As DataSet
             Dim myConnection As New MySqlConnection(CONNECTION_STRING)
             Dim myCommand As New MySqlCommand
             Dim myAdapter As New MySqlDataAdapter
             Dim myDS As New DataSet
             myCommand.Connection = myConnection
             myAdapter.SelectCommand = myCommand
             myCommand.CommandText = "SELECT * FROM Customers"
             Return myDS
         Catch ex As Exception
         End Try
     End Function
Last edited: