|
The table structure is as follows
a b
1 2
3 4
5 6
How to bind DropDownList to connect the contents of the two ab fields and display them in the drop-down box?
string comstr1 = "select DISTINCT companyid from templateinfo";
con.Open ();
SqlCommand cmd1 = new SqlCommand (comstr1, con);
SqlDataReader dr1 = cmd1.ExecuteReader ();
this.DropDownList2.DataSource = dr1;
this.DropDownList2.DataTextField = "a" + "b";
this.DropDownList2.DataBind ();
con.Close ();
The effect should be to pull down 12, 23, 34. My code can't be written like that. Everyone help me change it ~~ Thank you ~~ |
|