/// <summary> /// 绑定下拉等列表,控件需要继承自:ListControl。 /// </summary> /// <param name="control">DropDown/CheckBoxList/RadioButtonList等</param> /// <param name="where">对表的数据进行过滤如:"ID>15 and Url='cyqdata.com'"</param> /// <param name="text">绑定时显示的字段名[默认字段名取自控件的ID(去掉前三个字母前缀)]</param> /// <param name="value">绑定时显示字段对应的值[默认值的字段名为:ID]</param> public void Bind(object control, object where, object text, object value) { string sql = _SqlCreate.GetBindSql(where, text, value); MDataTable mTable = null; switch (_DbBase.dalType) { case DalType.Txt: case DalType.Xml: NoSqlCommand cmd = new NoSqlCommand(sql, _DbBase); mTable = cmd.ExeMDataTable(); cmd.Dispose(); break; default: mTable = _DbBase.ExeDataReader(sql, false); // dalHelper.ResetConn();//重置Slave break; } bool result = (mTable != null && mTable.Rows.Count > 0); if (result) { MBindUI.BindList(control, mTable); } }