Beispiel #1
0
        /// <summary>
        /// 绑定下拉列表 sql 语句
        /// </summary>
        /// <param name="pSql">sql 语句</param>
        /// <param name="pHtmlSelect">HtmlSelect</param>
        /// <param name="pEditValue">修改时值</param>
        /// <param name="pFieldValue">值字段 如:ProID</param>
        /// <param name="pFieldText">内容字段 如:ProName</param>
        /// <param name="pFirstValue">第一项的值</param>
        /// <param name="pFirstText">第一项的内容</param>
        public static void BGHtmlSelect(string pSql, HtmlSelect pDropList, string pEditValue, string pFieldValue, string pFieldText, string pFirstValue, string pFirstText)
        {
            if (pFirstText.Length > 0)
            {
                pDropList.Items.Add(new ListItem(pFirstText, pFirstValue));
            }

            using (DataTable dt = DbHelp.GetDataTable(pSql))
            {
                foreach (DataRow dr in dt.Rows)
                {
                    System.Web.UI.WebControls.ListItem drlist = new ListItem();
                    drlist.Text  = dr[pFieldText].ToString();
                    drlist.Value = dr[pFieldValue].ToString();

                    if (pEditValue == drlist.Value)
                    {
                        drlist.Selected = true;
                    }

                    pDropList.Items.Add(drlist);
                }
                dt.Clear();
            }
        }
Beispiel #2
0
        public DataTable GetDataTable()
        {
            DbHelpParam dhp = new DbHelpParam(this._sql, fd.CommType, fd.DataParm, fd.ConnProvider);

            return(DbHelp.GetDataTable(dhp));
        }