Exemple #1
0
        protected void Grid_PageIndexChanged(object source, DataGridPageChangedEventArgs e)
        {
            DataGrid9.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='C51' UNION SELECT * FROM database.detail WHERE detail.codeuser="******"urole"] + " AND detail.numzone='C51' "))
                    {
                        using (MySqlDataAdapter sda = new MySqlDataAdapter())
                        {
                            cmd.Connection    = con;
                            sda.SelectCommand = cmd;
                            using (DataTable dt = new DataTable())
                            {
                                sda.Fill(dt);

                                DataGrid9.DataSource = dt;
                                DataGrid9.DataBind();
                            }
                        }
                    }
                }
            }
        }
        protected void BindGrid9()
        {
            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='Sujets de conversations'"))
                    {
                        using (MySqlDataAdapter sda = new MySqlDataAdapter())
                        {
                            cmd.Connection    = con;
                            sda.SelectCommand = cmd;
                            using (DataTable dt = new DataTable())
                            {
                                sda.Fill(dt);

                                DataGrid9.DataSource = dt;
                                DataGrid9.DataBind();
                            }
                        }
                    }
                }
            }
        }
Exemple #3
0
 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='C51' UNION SELECT * FROM database.detail WHERE detail.codeuser='******' AND detail.numzone='C51' "))
             {
                 using (MySqlDataAdapter sda = new MySqlDataAdapter())
                 {
                     cmd.Connection    = con;
                     sda.SelectCommand = cmd;
                     using (DataTable dt = new DataTable())
                     {
                         sda.Fill(dt);
                         DataGrid9.DataSource = dt;
                         DataGrid9.DataBind();
                     }
                 }
             }
         }
     }
 }