DropDownList绑定多个字段

     string sql_ch = string.Format("select C_ID,C_name from T_Channel");
                DataTable dt_ch = DBUtility.DbHelperSQL.Query(sql_ch).Tables[0];
                if (dt_ch != null && dt_ch.Rows.Count > 0)
                {
                    for (int i = 0; i < dt_ch.Rows.Count; i++)
                    {
                        string strText = "[" + dt_ch.Rows[i]["C_ID"].ToString() + "]" + dt_ch.Rows[i]["C_name"].ToString();
                        string strValue = dt_ch.Rows[i]["C_ID"].ToString(); ;
                        ListItem listItem = new ListItem
                        {
                            Text = strText,
                            Value = strValue
                        };

                        this.DropDownList1.Items.Add(listItem);
                    }
                }

  

select * from test where year(regdate)=year(now()) and month(regdate)=month(now()) and day(regdate)=day(now())

  

posted @ 2018-05-24 16:50  晓涵在路上  阅读(333)  评论(0编辑  收藏  举报