In this article, you can learn about how to load datagridview from database C#. C# datagridview load data from database Mysql. This tutorial takes a specific table from a database and display it on a DataGridView. This is done with a DataReader  and data logic. A visual representation of data is the end result.

Let’s following this step for know to load data in Datagridview:

  1. Create database in mysql with name “test” and create table with name “user”, like the below.


  1. Create a new application project. In Visual Studio, on the menu click File> New  > Project. For more details, see the following menu on the display.


  1. Then will appear the window New Project like the look below.


  1. Write down the name of the project that will be created on a field Name. Specify the directory storage project by accessing the field Location. Next, give the name of the solution in the Solution Name. Then click OK.


  1. Create a new windows form like the below.


  1. Create a new class for connection database and write the following program listing :

  1. Next step, Back to windows form and view code to write the following program listing:

  1. After you write down the program listings, press the F5 key to run the program and if you successfull connect your database the result is :


We have explained how to make  program c# datagridview load data from database, for those of you who want to download the source code of the program also can. Hopefully this discussion is helpful to you.

You can see Load Datagridview From Database C# from Github project in Here.

Thank you for reading this article about Load Datagridview From Database C#, I hope this article is useful for you. Visit My Github about .Net Csharp in Here

Load Datagridview From Database C#

Leave a Reply

Your email address will not be published. Required fields are marked *