是否有使用 Enterprise Library 5.0 DAAB 填充下拉框的简单代码?
我已经尝试过了,但它不起作用:
cmbOffice.DataSource = _db.ExecuteDataSet(
CommandType.Text,
"select office_id, office_name from office").Tables[0];
cmbOffice.DataBind();
是否有使用 Enterprise Library 5.0 DAAB 填充下拉框的简单代码?
我已经尝试过了,但它不起作用:
cmbOffice.DataSource = _db.ExecuteDataSet(
CommandType.Text,
"select office_id, office_name from office").Tables[0];
cmbOffice.DataBind();
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();
cmbOffice.DataSource = _db.ExecuteDataSet(CommandType.Text,"select office_id, office_name from office").Tables[0].defaultView;
cmbOffice.DataBind();