You need a DataSet or DataTable that can be binded with GridView.This code will be added in the Page_Load() of default2.aspx(according to your specification):
string query = "your query";
SqlCommand cmd = new SqlCommand(query, conn);
DataTable results = new DataTable();
try
{
SqlDataAdapter adapter = new SqlDataAdapter(command);
adapter.Fill(results);
}
catch (Exception ex)
{
}
Then to bind Gridview:
GridView.DataSource=results;
GridView.DataBind();
Note I am not using conn.Open(), because the Fill() method will do that, according to msdn reference:
http://msdn.microsoft.com/en-us/library/bh8kx08z.aspx[
^]