MySQL and .NET

Administrator

VB.NET Forum Admin
Joined
Jun 3, 2004
Messages
1,462
Programming Experience
10+
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 (www.bytefx.com) 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 (http://dev.mysql.com/downloads/connector/net/1.0.html). 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.

Brandon
www.schenzcustomdesigns.com
 
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.

TPM
 
Here is how I do it.

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

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

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

4. Procedure to return DataSet:
VB.NET:
Private Function GetOrdersAndDetails() As DataSet
         Try
             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"
 
             myAdapter.Fill(myDS)
 
             Return myDS
         Catch ex As Exception
             MessageBox.Show(ex.ToString)
         End Try
     End Function
 
Last edited:
Back
Top