3

Can Visual Studio natively connect to a MySQL database or do I need to install a 3rd party connector first? Could someone please provide a small code example either way? I can't seem to make this work.

2 Answers 2

11

Can Visual Studio natively connect to a MySQL database?

Based upon my knowledge, no.

Do I need to install a 3rd party connector first?

Yes, MySQL has their own .NET Connector.

Could someone please provide a small code example either way? I can't seem to make this work.

Here is the link to the MySQL Connector documentation..

In there, I found this example:

Imports System.Data Imports MySql.Data Imports MySql.Data.MySqlClient Public Class Tutorial1 Public Shared Sub Main() Dim connStr As String = "server=localhost;user=root;database=world;port=3306;password=******;" Dim conn As New MySqlConnection(connStr) Try Console.WriteLine("Connecting to MySQL...") conn.Open() Catch ex As Exception Console.WriteLine(ex.ToString()) End Try conn.Close() Console.WriteLine("Done.") End Sub End Class 
Sign up to request clarification or add additional context in comments.

Comments

1

You can install the MySQL .NET connector from the following link

http://dev.mysql.com/downloads/connector/net/

and view a previous C# related answer of mine here:

Connecting to a Mysql DB with C# - Need some with Datasets

Sorry I dont have a VB related one but I'm sure you'd find plenty of examples here or on the web :P

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.