public void Bind() { con.Open(); SqlCommand cmd = new SqlCommand("select * from EmployeeTable1", con); SqlDataAdapter adapt = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); adapt.Fill(ds, "EmployeeTable1"); RP1.DataSource = ds.Tables[0]; RP1.DataBind(); con.Close(); }
public void Bind() { conn.Open(); SqlCommand cmd = new SqlCommand("select * from StudentTable", conn); SqlDataAdapter sd = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); sd.Fill(ds, "StudentTable"); RP1.DataSource = ds.Tables[0]; RP1.DataBind(); conn.Close(); }
protected void Page_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); con.Open(); SqlCommand cmd = new SqlCommand("select * from Student", con); SqlDataReader rd = cmd.ExecuteReader(); RP1.DataSource = rd; RP1.DataBind(); con.Close(); }
public void Bind() { con.Open(); SqlCommand cmd = new SqlCommand("Select * from StudentTable", con); //select all the record present in the datatable SqlDataAdapter adapt = new SqlDataAdapter(cmd); //retreiving data by creating an instance DataSet ds = new DataSet(); //setting data into single frame adapt.Fill(ds, "StudentTable"); //record of employee table record o RP1.DataSource = ds.Tables[0]; RP1.DataBind(); con.Close(); }
public void Bind() { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); con.Open(); SqlCommand cmd = new SqlCommand("Select * from StudentTable", con); SqlDataAdapter adpt = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); adpt.Fill(ds, "StudentTable"); RP1.DataSource = ds.Tables[0]; RP1.DataBind(); con.Close(); }