• Introduction of DataSet
• Gridview control
• Several operation with GridView
• Replaces the ADO Recordset
• Represents a cache of data that contains tables,
columns, relationships, and constraints, just like a
• Regardless of where the source data comes from, data
can all be placed into DataSet objects
• Tracks changes that are made to the data it holds
before updating the source data.
As revolutionary as a DataSet might be, it is not the
best choice in every situation. Often, using a DataSet
might not be appropriate; instead, using a DataReader
might be better.
Because the DataSet is a disconnected copy of the
data, you can work with the same records repeatedly
without having to go back to the data store. This
capability can greatly increase performance and
lessen the load upon the server.
• The GridView control is a powerful data grid control
that allows you to display an entire collection of
data,add sorting and paging, and perform inline
• GridView by dragging the control onto the design
surface of an ASP.NET Web page.
• In column definition TemplateField &ItemTemplate
we will insert any control .
• Customizing Columns in the
If you have your grid configured to automatically
generate columns based on the bound data source,
the grid creates fields for each public property
exposed by the data source.
Field Control Description
BoundField Displays the value of a field in a data source. This is
the default column type of the GridView control.
CheckBoxField Displays a check box for each item in the GridView
control. This column field type is commonly used to
display fields with a Boolean value.
HyperLinkField Displays the value of a field in a data source as a
hyperlink. This column field type allows you to bind a
second field to the hyperlink’s URL.
ButtonField Displays a command button for each item in the
GridView control. This allows you to create a column
of custom button controls, such as an Add or Remove
ImageField Automatically displays an image when the data in the
field represents an image.
• DataSet ds_Row = new DataSet();
• ds_Row = dcon.Data_inventer("Select
Subject as Subject,courseOffer as
Courses_Offer from Course order by
• GridView_course.DataSource =
• GridView_course.EditIndex = -1;
“FirstSample” is the key name in web config.
Now Connection open & close
• public SqlConnection open()
• return con_course;
• public SqlConnection close()
• return null;
Simple code analysis
Creating a connection class:
• //Connection Establishment With siliguri DataBase
• public SqlConnection Siliguri_conn()
• con_course = new
• return con_course;
Insert Update Delete Command for
• public void inupdl(string str)
• SqlCommand comm = new SqlCommand();
• comm.Connection = Siliguri_conn();
• comm.CommandText = str;
Fill Datatable into DataSet From
• public DataSet Data_inventer(string str)
SqlDataAdapter adpt_inven = new
• DataSet ds = new DataSet();
• return ds;
Create a object for connec class
connec com_info = new connec();
Now run insert,Update & Delete command
com_info.inupdl("insert into TestValue values('" +
TextBox1.Text + "','" + TextBox2.Text + "')");
Now retrieve data from Table:
DataSet ds=new DataSet();
ds. Data_inventer(“Select * From TestValue);
Binding Data into Table
GridView1.DataSource = ds;
• GridView Controls.
• Several Operation into Gridview Control.
• Connection with SQL.Server program and
execute SQL command.