DropDownList绑定数据库

this.DropDownList_设备列表.DataSource = dt_eq;//设置数据源
this.DropDownList_设备列表.DataTextField = "equipment_name";//设置所要读取的数据表里的列名
this.DropDownList_设备列表.DataValueField = "equipment_id";
this.DropDownList_设备列表.DataBind();//数据绑定
this.DropDownList_设备列表.SelectedIndex = 0;

猜你喜欢

转载自www.cnblogs.com/asdyzh/p/9747481.html