1. Open Visual Studio
2. Create a New Website
2. Create a New Website
3 From Database - > Select Stored Procedure -> Right Click - > Add New Stored Procedure.
4. Create Select Query for Employee Table.
5. Create a method in class for select.
public DataSet Select_Employee()
{
SqlCommand cmd = new SqlCommand("Select_Employee", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter();
DataSet ds = new DataSet();
da.SelectCommand = cmd;
da.Fill(ds);
return ds;
}
6. Add Web Page and Place Gridview.
7. Add namaspace
using System.Data
8. On Page_Load write Code as below.
DataSet ds = new DataSet();
mainClass objmain = new mainClass();
protected void Page_Load(object sender, EventArgs e)
{
ds = objmain.Select_Employee();
if (ds.Tables[0].Rows.Count > 0)
{
GridView1.DataSource = ds;
GridView1.DataBind();
}
}
9. Click F5.