hi,i have a page,in which i want to display the student tails from registration table,and marks,date from results table.
i wrote the code ,can any one tell me is this code correct or not?because the gridview is not displaying when i run it?
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace newonlineexam
{
public partial class ExamDetailsAdmin : System.Web.UI.Page
{
SqlConnection con = new SqlConnection("user id=sa;password=Ektha@2013;database=Database1.mdf;Data Source=IPOG-A95E1056D3");
protected void Page_Load(object sender, EventArgs e)
{
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
con.Open();
SqlDataAdapter da = new SqlDataAdapter("Select * from ExamDetails", con);
DataSet ds = new DataSet();
da.Fill(ds, "ExamDetails");
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
}
}
}
manimala