Follow these steps
1.open asp.net
2.FILE-->new WEBSITE(default.aspx page created)
3.TOOLBAR-->DATA-->GRID VIEW
or
write this code in default.aspx page
<asp:gridview id="GridView1" runat="server" xmlns:asp="#unknown">
onselectedindexchanged="GridView1_SelectedIndexChanged">
4.Now a grid box will appear, to insert your data
5.In SSMS or SQL (server management studio)
5.1 In OBJECT EXPLORER-->DATABASES-->NEW DATABASE-->DATABASE NAME(abc)
5.2 Now we have created a database
5.3 select-->NEW QUERY option
5.4 Write these queries
create table months(m_id int,m_name varchar(20),q_numb int,semester int)
insert into months values(1,'jan',1,1)
insert into months values(2,'feb',1,1)
insert into months values(3,'mar',1,1)
insert into months values(4,'apr',2,1)
insert into months values(5,'may',2,1)
insert into months values(6,'jun',2,1)
insert into months values(7,'jul',3,2)
insert into months values(8,'aug',3,2)
insert into months values(9,'sep',3,2)
insert into months values(10,'oct',4,2)
insert into months values(11,'nov',4,2)
insert into months values(12,'dec',4,2)
select * from months
6.Now go back to default.aspx page
go to design mode(at bottom of page)
7.double click on the grid that appears.
8.It will be redirected to default aspx.cs page
9.In that page their will be a function
protected void Page_Load(object sender, EventArgs e)
{
}
10.In that function write the following code
SqlConnection con = new SqlConnection(@"Data Source=<from system="">;Initial Catalog=arc;Integrated Security=True"); //<from system="">-->SERVER EXPLORER-->DATA CONNECTIONS-->ADD CONNECTION
//-->SERVER NAME(select)-->OK
// Next right click on the connection-->properties(copy the connection
// string to DATA SOURCE
con.Open();
//SqlDataAdapter Comm = new SqlDataAdapter("SELECT m_id,m_name FROM months", con);
SqlDataAdapter Comm1 = new SqlDataAdapter("INSERT INTO months(m_id,m_name) VALUES(1,'ppt')", con);
SqlDataAdapter Comm = new SqlDataAdapter("SELECT m_id,m_name FROM months", con);
DataSet ds = new DataSet();
Comm.Fill(ds);
DataTable dt = new DataTable();
dt = ds.Tables[0];
GridView1.DataSource = dt;
GridView1.DataBind();
con.Close();
This is a simple example just for beginners
Thank you