protected void Page_Load(object sender, EventArgs e) { try { if (Session["role"].Equals("")) { Response.Write("<script>alert('You dont have access. Please Register yourself or login.');</script>"); Response.Redirect("LoginPage.aspx"); } } catch (Exception ex) { // } string strcon = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; SqlConnection con = new SqlConnection(strcon); //strcon is Connection String con.Open(); SqlCommand cmd = new SqlCommand("SELECT * FROM [dbo].[petgroom]", con); SqlDataAdapter sda = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); sda.Fill(dt); RepArticle.DataSource = dt; RepArticle.DataBind(); con.Close(); }
protected void Page_Load(object sender, EventArgs e) { string strcon = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; SqlConnection con = new SqlConnection(strcon); //strcon is Connection String con.Open(); SqlCommand cmd = new SqlCommand("SELECT * FROM [dbo].[petTraining]", con); SqlDataAdapter sda = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); sda.Fill(dt); RepArticle.DataSource = dt; RepArticle.DataBind(); con.Close(); }