Skip to main content

DataGridView Control with MySQL


I received a lot of email if I can make a tutorial on how to connect VB.NET with MySQL. So here it is. I am planning to continue this tutorial that is similar on my previous article on Database Programming Made Easy. The only difference with the previous one is that I will be using MySQL instead of MS Access and MS SQL Server.

This tutorial will teach you how to connect Visual Basic .NET 2008 to MySQL Server v5.0. I used DataGridView Control as the model of this tutorial.

In order to run this tutorial successfully you need to import two files included in the zip file. First import Creates.sql, second import Inserts.sql using Toad. For more information on the software requirements please read Visual Basic and MySQL article.

You will find in this code from my previous tutorial on DataGridView Control using MS Access and MS SQL Server very similar except for the connectivity issue.

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Comments

Submitted byvandaon Tue, 08/25/2009 - 18:11

I think if you wanna share your idea to all member please you post the completed project don't try to post the error project.

Hi beginner, If you do not know how to debug the program and wondering how to fix it, it's better to grab a book or if you have a book already then throw it away and leave this community and live for PEACE! hohohoho! Cheers!
Submitted byAnonymous (not verified)on Wed, 09/16/2009 - 12:04

Hi, I would like to display DataGrideView all of rows with picture icon. How should i do? again, with DataGridView. i can sellect record by clicking and keyUp or Down. instead of this how can i do? i would like to create next or previous buttons. Thanks in advance, Chantra
Submitted byAnonymous (not verified)on Thu, 10/29/2009 - 14:13

we have the same logic in viewing data in datagrid. My poblem is I can't change the column let say my column in mysql database is employee_name and I would like to change into Employee Name. How could I do that? Please help me sir.
Submitted byadminon Fri, 10/30/2009 - 08:55

In reply to by Anonymous (not verified)

You can use aliases. Ex: SELECT employee_name AS [Employee Name] FROM Employees
Submitted byAnonymous (not verified)on Thu, 11/19/2009 - 13:54

very very thanks, realy use your code. thansk a lot
Submitted byAnonymous (not verified)on Thu, 11/26/2009 - 09:34

Do you have any idea about whenver i click a row and i click a button. It will lead to the new form and each of the data fields of that selected row is in the textboxes? like in my datagrid Name Age Sex Me 10 M You 11 F If i am going to select the whole second row And click to a button "update" it will get the values of this and transfer to my textboxes. Name You Age 11 Sex M
Submitted byAnonymous (not verified)on Fri, 01/22/2010 - 01:38

sir, thanks for this it worked.. but when i edit some records there's a warning prompting: "Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information" it's useful when i create new record and save it in database.. pls. help
Submitted byAnonymous (not verified)on Mon, 06/14/2010 - 00:15

good work how to print a picture from the database in Visual Basic.net 2008
Submitted byAnonymous (not verified)on Tue, 12/14/2010 - 19:43

Hi and thanks,

Nice sourcecode, well written, no overkill,... no article.

Where is the text that goes with the sourcecode ? Or isn't there one ?

Best regards, Smisse

Submitted byAnonymous (not verified)on Thu, 06/16/2011 - 16:52

I tried to inserted data into mysql database using vb.net2008.When i Click Save Button it Showing Error
Message "There is no Source Code available in Current Location! " Please Tell me Solution For this problem.

Submitted byAnonymous (not verified)on Fri, 07/15/2011 - 18:47

THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU --- THANK YOU ---

Add new comment

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.