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.
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
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
I found the following site to be very useful for making a connection to MYSQL in the vb.net series. Contains screen shots and text instructions. It might not work for everyone, but it gave me the things I needed. Yes, this is very similar if not identical to the post before mine. http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-1
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.