简体   繁体   English

如何使用Enterprise Library 5.0填充下拉列表

[英]How to Populate a dropdown using Enterprise Library 5.0

Is there a simple code to populate a dropdown box using Enterprise Library 5.0 DAAB? 是否有简单的代码使用Enterprise Library 5.0 DAAB填充下拉框?

I've tried this, but it is not working: 我已经尝试过了,但是没有用:

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.DataSource = _db.ExecuteDataSet(CommandType.Text,“从办公室选择office_id,office_name”)。表[0] .defaultView;
cmbOffice.DataBind(); cmbOffice.DataBind();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM