是否有使用Enterprise Library 5.0 DAAB填充下拉框的简单代码?
我试过这个,但它不起作用:
cmbOffice.DataSource = _db.ExecuteDataSet(
CommandType.Text,
"select office_id, office_name from office").Tables[0];
cmbOffice.DataBind();
答案 0 :(得分:1)
DataSet ds = _db.ExecuteDataSet(
CommandType.Text,
"select office_id, office_name from office");
cmbOffice.DataSource = ds;
cmbOffice.DataValueField= "office_id";
cmbOffice.DataTextField = "office_name";
cmbOffice.DataBind();
答案 1 :(得分:0)
cmbOffice.DataSource = _db.ExecuteDataSet(CommandType.Text,“select office_id,office_name from office”)。Tables [0] .defaultView;
cmbOffice.DataBind();