private void showBoxList()
{
sql="select * from keywords order by id desc";
objComm = new OleDbCommand(sql,objConn);
objConn.Open();
OleDbDataReader dr=objComm.ExecuteReader(CommandBehavior.CloseConnection);
if(dr.Read())
{
this.CheckBoxList1.DataSource=dr;
this.CheckBoxList1.DataBind();
}


}
这样在调试时出现的全是:System.Data.Common.DbDataRecord
第二个问题:
如何显示我选中的所有复选框的text属性值?

解决方案 »

  1.   

    利用: CheckBoxList.Item.Add()这个方法
      

  2.   

    CheckBoxList1.Items.Add(string Item) 或者 CheckBoxList1.Items.Add(ListItem Item)
      

  3.   

    CheckBoxList1.DataTextFiled="column name that you want to show"
    CheckBoxList1.DataValueFile="column name that you want to manipulate"
      

  4.   

    CheckBoxList1.DataTextFiled="column name that you want to show"
    CheckBoxList1.DataValueFile="column name that you want to manipulate"
      

  5.   

    Dim c As New OleDbConnObj        Dim mycom As New OleDbCommand("select book_id,book_Name from t_bookinfo where book_id < 100", c.ConnObj)
            c.ConnObj.Open()      
            Dim a As New ArrayList        Dim dr As OleDbDataReader = mycom.ExecuteReader
            While dr.Read            a.Add(dr("book_id"))
            End While
            Me.CheckBoxList1.DataSource = a
            Me.CheckBoxList1.DataBind()
            c.ConnObj.Close()奶奶的,这个问题搞了几个小时,不知道什么地方搞错误了,郁闷。
    楼主测试吧,应该没问题了。我测试成功