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