protected void BindGrid7() { if (!this.IsPostBack) { string constr = ConfigurationManager.ConnectionStrings["WebAppConnString"].ConnectionString; using (MySqlConnection con = new MySqlConnection(constr)) { using (MySqlCommand cmd = new MySqlCommand("SELECT * FROM database.activite WHERE activite.iduser='******' AND activite.nature='Rendre service'")) { using (MySqlDataAdapter sda = new MySqlDataAdapter()) { cmd.Connection = con; sda.SelectCommand = cmd; using (DataTable dt = new DataTable()) { sda.Fill(dt); DataGrid7.DataSource = dt; DataGrid7.DataBind(); } } } } } }
protected void Grid_PageIndexChanged(object source, DataGridPageChangedEventArgs e) { DataGrid7.CurrentPageIndex = e.NewPageIndex; if (!this.IsPostBack) { string constr = ConfigurationManager.ConnectionStrings["WebAppConnString"].ConnectionString; using (MySqlConnection con = new MySqlConnection(constr)) { using (MySqlCommand cmd = new MySqlCommand("SELECT * FROM database.titre WHERE titre.codeuser="******"urole"] + " AND titre.numzone='C41' UNION SELECT * FROM database.detail WHERE detail.codeuser="******"urole"] + " AND detail.numzone='C41' ")) { using (MySqlDataAdapter sda = new MySqlDataAdapter()) { cmd.Connection = con; sda.SelectCommand = cmd; using (DataTable dt = new DataTable()) { sda.Fill(dt); DataGrid7.DataSource = dt; DataGrid7.DataBind(); } } } } } }
protected void BindData() { if (!this.IsPostBack) { string constr = ConfigurationManager.ConnectionStrings["WebAppConnString"].ConnectionString; using (MySqlConnection con = new MySqlConnection(constr)) { using (MySqlCommand cmd = new MySqlCommand("SELECT * FROM database.titre WHERE titre.codeuser='******' AND titre.numzone='C41' UNION SELECT * FROM database.detail WHERE detail.codeuser='******' AND detail.numzone='C41' ")) { using (MySqlDataAdapter sda = new MySqlDataAdapter()) { cmd.Connection = con; sda.SelectCommand = cmd; using (DataTable dt = new DataTable()) { sda.Fill(dt); DataGrid7.DataSource = dt; DataGrid7.DataBind(); } } } } } }