Saturday, June 25, 2005

Visual Basic .NET and MySQL Connection

I've been wondering for quite a long time whether it's possible to connect from Microsoft Visual Basic .NET (VB.NET) to the most popular open source database, MySQL and I do a little research online to try it out. Incredibly, it can done in just a few minutes. Here's my experience...

What I'm using:

  1. Microsoft Windows XP Pro (Operating System)

  2. Microsoft Visual Studio 2003

  3. MySQL version 3.23.38

What I did:

  1. Download and install ODBC.NET Provider from Microsoft.

  2. Download and install MyODBC Driver from MySQL.

  3. Setup MyODBC DSN in ODBC.
    Control Panel > Administrative Tools > Data Source (ODBC)

  4. Copy and modify sample source code from MySQL to test my program and ... VB.NET is already able to query from MySQL database!

It's just as simple as that!

Recommended Materials:
Accessing a MySQL Database with a VB.NET Component in an ASP.NET File
Microsoft Visual Studio .NET 2003 Professional Special Edition


Blogger DumbWebProgrammer said...

How about VB6 with MySQl ?? Can still use the technique you teach here??

6:06 PM  
Blogger EngLee said...

For VB6, you can skip the first step.
And, the source code for VB6 will be different from VB.NET.

6:25 PM  
Blogger Yoon Kit said...

why dont you use this:

MySQL Connector/Net for ADO.NET

Gives you direct access to the MySQL API in dotNET. I use it and it works great.


10:06 AM  
Blogger EngLee said...

I will try it out. Thanks for sharing. :)

10:10 AM  
Anonymous Anonymous said...

I did use several ways to connect MySQL with MS FoxPro.. It did work.

10:45 AM  
Anonymous Anonymous said...

to Yoon kit,

i've use MySQL Connector/Net for ADO.NET. but why it didn't work? "" does not appear, so i can't use mySqlconnection. I've try to add reference,but the message is "this file(MySql.Data.dll) is not a valid assembly or COM component".
Please help me.....

please contact me at

2:06 PM  
Anonymous Anonymous said...

1. Download and install ODBC.NET Provider from Microsoft.

hi this is nice but i think in .net framework 2, it is already bundled upon accessing


6:25 PM  
Anonymous Anonymous said...

is this works with mysql version 5? or 5.01? need help pls

2:03 AM  
Anonymous generic cialis said...

I, of course, a newcomer to this blog, but the author does not agree

2:08 PM  

Post a Comment

<< Home

Can't find what you want? Search it here!