protected void BindGrid10() { 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='Activités mentales'")) { using (MySqlDataAdapter sda = new MySqlDataAdapter()) { cmd.Connection = con; sda.SelectCommand = cmd; using (DataTable dt = new DataTable()) { sda.Fill(dt); DataGrid10.DataSource = dt; DataGrid10.DataBind(); } } } } } }
protected void Grid_PageIndexChanged(object source, DataGridPageChangedEventArgs e) { DataGrid10.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='C52' UNION SELECT * FROM database.detail WHERE detail.codeuser="******"urole"] + " AND detail.numzone='C52' ")) { using (MySqlDataAdapter sda = new MySqlDataAdapter()) { cmd.Connection = con; sda.SelectCommand = cmd; using (DataTable dt = new DataTable()) { sda.Fill(dt); DataGrid10.DataSource = dt; DataGrid10.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='C52' UNION SELECT * FROM database.detail WHERE detail.codeuser='******' AND detail.numzone='C52' ")) { using (MySqlDataAdapter sda = new MySqlDataAdapter()) { cmd.Connection = con; sda.SelectCommand = cmd; using (DataTable dt = new DataTable()) { sda.Fill(dt); DataGrid10.DataSource = dt; DataGrid10.DataBind(); } } } } } }