protected void Page_Load(object sender, EventArgs e) { try { db.s = "select numFournisseur from fournisseur"; SqlDataAdapter cmd = new SqlDataAdapter(db.s, db.cnx); DataTable dt = new DataTable(); cmd.Fill(dt); DropDownlist1.DataSource = dt; DropDownlist1.DataBind(); DropDownlist1.DataTextField = "numFournisseur"; DropDownlist1.DataBind(); db.s = "select numMarche from marche"; SqlDataAdapter c = new SqlDataAdapter(db.s, db.cnx); DataTable d = new DataTable(); c.Fill(d); DropDownlist2.DataSource = d; DropDownlist2.DataBind(); DropDownlist2.DataTextField = "numMarche"; DropDownlist2.DataBind(); db.s = "select nom from fournisseur"; SqlDataAdapter ss = new SqlDataAdapter(db.s, db.cnx); DataTable ee = new DataTable(); ss.Fill(ee); DropDownlist3.DataSource = ee; DropDownlist3.DataBind(); DropDownlist3.DataTextField = "nom"; DropDownlist3.DataBind(); } catch { } }
protected void Page_Load(object sender, EventArgs e) { db.s = "select numMarche from marche"; SqlDataAdapter cmd = new SqlDataAdapter(db.s, db.cnx); DataTable dt = new DataTable(); cmd.Fill(dt); DropDownlist1.DataSource = dt; DropDownlist1.DataBind(); DropDownlist1.DataTextField = "numMarche"; DropDownlist1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { try { db.s = "select numRetenueGarantie from retenueGarantie"; SqlDataAdapter cmd = new SqlDataAdapter(db.s, db.cnx); DataTable dt = new DataTable(); cmd.Fill(dt); DropDownlist1.DataSource = dt; DropDownlist1.DataBind(); DropDownlist1.DataTextField = "numRetenueGarantie"; DropDownlist1.DataBind(); } catch { } }
public void bind1() { conn = new SqlConnection(cs); using (SqlCommand cmd = new SqlCommand("select * from branch_master", conn)) { using (SqlDataAdapter adp = new SqlDataAdapter(cmd)) { DataTable dt = new DataTable(); adp.Fill(dt); if (dt.Rows.Count > 0) { DropDownlist1.DataSource = dt; DropDownlist1.DataTextField = "branch_name"; DropDownlist1.DataValueField = "branch_id"; DropDownlist1.DataBind(); } } } }