* IBM to offer mobile security as a service IBM will start delivering mobile security-as-a-service (MaaS) through its own cloud infrastructure in India, a move that is expected to better address in-country data requirements... IBM Spectrum Computing: IBM has enlarged its portfolio of software-defined infrastructure solutions with cognitive features for workload management.  * LiFi internet technology has been introduced, the new type of wireless internet connection that gives 100 times faster than traditional WiFi -- Invented by Professor Harald Haas from the University of Edinburgh. * Sci. Rachid Yazami has developed a smart chip that charges smartphones in less than 10 minutes. BenQ has launched BlueCore projector - Consumer electronics major BenQ has launched its first BlueCore laser light source projector. For those unaware, devices with BlueCore laser technology have a high contrast output of 80000:1 with an extended lamp life and efficiency. *** 
  Nov 9 2014 7:45AM     Michael Ryan
  2 Comments    5491 Views  
Here Michael Ryan provided a short tutorial with example, how to bind (fill) DataGridView control in Windows Forms Application using DataSet in C#.
For binding the gridview, First have to create a table in Microsoft SQL Server Database as shown below.
Creating a table
When creating a table make Identity Specification as true for column 'ID'.

Set the table name as shown below.
Adding a DataGridView to the Windows Form
Firstly you need to add a DataGridView control to the Windows Form from the Visual Studio ToolBox as shown below.

You will need to import the following namespace.

using System.Data;
using System.Data.SqlClient;

Binding of data to DataGridView from Database using DataSet in C#
Below is the sample code for binding data to DataGridView from Database using DataSet in C#.

public partial class Form1 : Form 
   public Form1()

   private void Form1_Load(object sender, EventArgs e)
   private void BindGrid()
       string conString = " server=Your Server Name; database=Your Database Name; uid=***; password=****; "; 
       SqlConnection conn = new SqlConnection(conString); 
       DataSet ds = new DataSet(); 
           SqlCommand cmd = new SqlCommand("SELECT * FROM Employee", conn); 
           SqlDataAdapter da = new SqlDataAdapter(); 
           da.SelectCommand = cmd; 
           dataGridView1.DataSource = ds.Tables[0];
       catch (Exception ex)
           //Exception Message

I hope this page will helps to create Windows Forms Application with DataGridView binding. Thanks.

Micheal MC
Nov 9 2014 7:47AM
Thanks Working fine
John L
Nov 9 2014 7:47AM
Nice Information

Recent Posts
Create Amazon ElasticCache Using Memcached in CSharp
Oct 29 2018 12:09PM Posted By Amose
Get Google Map Lat Lng (Geo Point) By Pincode in C#
Oct 28 2018 12:09PM Posted By Pranav
Google URL Shortener in C#
Oct 20 2018 12:09PM Posted By Sanjay
Bind Gridview from CSV file in Asp.Net C#
Oct 5 2018 12:09PM Posted By Michael
Call WebService method from jQuery in every 1 minute
Sep 26 2018 12:09PM Posted By John
Gridview custom CSS in ASP.Net
Sep 14 2018 12:09PM Posted By Micheal Ryan
Read excel file and bind to Gridview in C#
Sep 10 2018 12:09PM Posted By Micheal
Follow us on Facebook
Follow us on Google +
Recent post in your Email inbox.
Enter your email address: