Friday, May 8, 2009

Working with DatagridView and SQL Database

This lesson will show you how to display data using .NET DataGridView control, C#.NET.The DataGridView control is a powerful tool and is simple to implement.

First you will need to import the System.Data.SqlClient namespace.The System.Data.Sqlclient namespace contain the sqlCommand and SqlConnection classes that we need in order to connect to our database and to send SQL command to it.

First we will look at our Simple Form design.


Here we will do the coding only for the button click event and here is the coding part for the Button click event.



And Here is final result.