DataGridView Control with MySQL

Submitted by: 
Visitors have accessed this post 52595 times.

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

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 ---

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.

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

good work

how to print a picture from the database in Visual Basic.net 2008

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

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

Search for ListView control sample at the vb.net language. I think this is what you mean.

I am using visual c#.. do you know how to do it sir? help please.. email me sir for reply :)

[email protected] please thanks

very very thanks, realy use your code. thansk a lot

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.

You can use aliases. Ex:

SELECT employee_name AS [Employee Name] FROM Employees

i have 10 record in datagrid i delete 8 no. record i want

9 get 8 postion or 9 get 8 index no autometically and only nine rcord remain in datagrid

I think this is not a problem since it will be handled by datagrid itself.

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

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!

thnx for the project. Working flawlessly

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • You may insert videos with [video:URL]
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe> [video]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.