/// <summary>得到一个对象实体 /// /// </summary> public Nikita.Assist.DBManager.Model.Bse_DataDictionary GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * from Bse_DataDictionary "); strSql.Append(" where id=@id "); MSSQLHelper h = new MSSQLHelper(GlobalHelp.ConfigConn); h.CreateCommand(strSql.ToString()); h.AddParameter("@id", id); Nikita.Assist.DBManager.Model.Bse_DataDictionary model = null; using (IDataReader dataReader = h.ExecuteReader()) { if (dataReader.Read()) { model = ReaderBind(dataReader); } h.CloseConn(); } return(model); }
/// <summary>根据条件得到一个对象实体 /// /// </summary> public Nikita.Assist.DBManager.Model.Bse_DataDictionary GetModelByCond(string cond) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from Bse_DataDictionary "); if (!string.IsNullOrEmpty(cond)) { strSql.Append(" where " + cond); } MSSQLHelper h = new MSSQLHelper(GlobalHelp.ConfigConn); h.CreateCommand(strSql.ToString()); Nikita.Assist.DBManager.Model.Bse_DataDictionary model = null; using (IDataReader dataReader = h.ExecuteReader()) { if (dataReader.Read()) { model = ReaderBind(dataReader); } h.CloseConn(); } return(model); }
/// <summary>分页获取数据列表 /// /// </summary> public List <Nikita.Assist.DBManager.Model.Bse_DataDictionary> GetListArray(string fileds, string order, string ordertype, int PageSize, int PageIndex, string strWhere) { MSSQLHelper h = new MSSQLHelper(GlobalHelp.ConfigConn); h.CreateStoredCommand("[proc_SplitPage]"); h.AddParameter("@tblName", "Bse_DataDictionary"); h.AddParameter("@strFields", fileds); h.AddParameter("@strOrder", order); h.AddParameter("@strOrderType", ordertype); h.AddParameter("@PageSize", PageSize); h.AddParameter("@PageIndex", PageIndex); h.AddParameter("@strWhere", strWhere); List <Nikita.Assist.DBManager.Model.Bse_DataDictionary> list = new List <Nikita.Assist.DBManager.Model.Bse_DataDictionary>(); using (IDataReader dataReader = h.ExecuteReader()) { while (dataReader.Read()) { list.Add(ReaderBind(dataReader)); } h.CloseConn(); } return(list); }
/// <summary>获得数据列表(比DataSet效率高,推荐使用) /// /// </summary> public List <Nikita.Assist.DBManager.Model.Bse_DataDictionary> GetListArray(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * "); strSql.Append(" FROM Bse_DataDictionary "); if (strWhere.Trim() != "") { strSql.Append(" where " + strWhere); } List <Nikita.Assist.DBManager.Model.Bse_DataDictionary> list = new List <Nikita.Assist.DBManager.Model.Bse_DataDictionary>(); MSSQLHelper h = new MSSQLHelper(GlobalHelp.ConfigConn); h.CreateCommand(strSql.ToString()); using (IDataReader dataReader = h.ExecuteReader()) { while (dataReader.Read()) { list.Add(ReaderBind(dataReader)); } h.CloseConn(); } return(list); }