public void gridload() { DataTable dt = new DataTable(); DataTable dt2 = new DataTable(); if (conn.State == ConnectionState.Closed) { conn.Open(); } SqlCommand x = new SqlCommand("select * from tblUG_report", conn); SqlCommand x2 = new SqlCommand("select * from tblPG_report", conn); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = x; da.Fill(dt); SqlDataAdapter da2 = new SqlDataAdapter(); da2.SelectCommand = x2; da2.Fill(dt2); GridViewUG.DataSource = dt; GridViewUG.DataBind(); GridViewPG.DataSource = dt2; GridViewPG.DataBind(); if (conn.State == ConnectionState.Open) { conn.Close(); } }
public void gridloadReport() { DataTable dt = new DataTable(); DataTable dt2 = new DataTable(); DataTable dt3 = new DataTable(); DataTable dt4 = new DataTable(); DataTable dt5 = new DataTable(); if (conn.State == ConnectionState.Closed) { conn.Open(); } SqlCommand x = new SqlCommand("select * from tblUG_report", conn); SqlCommand x2 = new SqlCommand("select * from tblPG_report", conn); SqlCommand x3 = new SqlCommand("select * from faculty order by FA_YEAR ", conn); SqlCommand x4 = new SqlCommand("select * from tblStdResearch where STDR_COURSE='PG'", conn); SqlCommand x5 = new SqlCommand("select * from tblStdResearch where STDR_COURSE='UG'", conn); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = x; da.Fill(dt); SqlDataAdapter da2 = new SqlDataAdapter(); da2.SelectCommand = x2; da2.Fill(dt2); SqlDataAdapter da3 = new SqlDataAdapter(); da3.SelectCommand = x3; da3.Fill(dt3); SqlDataAdapter da4 = new SqlDataAdapter(); da4.SelectCommand = x4; da4.Fill(dt4); SqlDataAdapter da5 = new SqlDataAdapter(); da5.SelectCommand = x5; da5.Fill(dt5); GridViewUG.DataSource = dt; GridViewUG.DataBind(); GridViewPG.DataSource = dt2; GridViewPG.DataBind(); GridViewFaculty.DataSource = dt3; GridViewFaculty.DataBind(); GridViewPG_RESEARCH.DataSource = dt4; GridViewPG_RESEARCH.DataBind(); GridViewUG_RESEARCH.DataSource = dt5; GridViewUG_RESEARCH.DataBind(); if (conn.State == ConnectionState.Open) { conn.Close(); } }