0

是否有使用 Enterprise Library 5.0 DAAB 填充下拉框的简单代码?

我已经尝试过了,但它不起作用:

cmbOffice.DataSource = _db.ExecuteDataSet(
      CommandType.Text,
      "select office_id, office_name from office").Tables[0]; 
cmbOffice.DataBind();
4

2 回答 2

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();
于 2011-01-18T19:41:40.237 回答
0

cmbOffice.DataSource = _db.ExecuteDataSet(CommandType.Text,"select office_id, office_name from office").Tables[0].defaultView;
cmbOffice.DataBind();

于 2011-01-18T17:20:59.333 回答