/// <summary> /// 得到列表 /// </summary> /// <param name="ent"></param> /// <returns></returns> public List <BuCityInfo> GetBuCityInfoList(string Where) { List <BuCityInfo> list = new List <BuCityInfo>(); using (DbDataReader reader = DataBaseManage.ExecuteReader(DalSql + Where)) { while (reader.Read()) { BuCityInfo ent = new BuCityInfo(); SetEnt(ent, reader); list.Add(ent); } } return(list); }
/// <summary> /// 根据CityCode得到 BuCityInfo 实体 /// </summary> /// <param name="ent"></param> /// <returns></returns> public BuCityInfo GetBuCityInfo(string CityCode) { BuCityInfo ent = null; string sql = DalSql; sql = sql + " And CityCode"; MySqlParameter[] paras = new MySqlParameter[] { new MySqlParameter("CityCode", CityCode) }; using (DbDataReader reader = DataBaseManage.ExecuteReader(sql, paras)) { if (reader.Read()) { ent = new BuCityInfo(); SetEnt(ent, reader); } } return(ent); }
public void SetEnt(BuCityInfo ent, IDataReader dr) { ent.CityCode = MyConvert.ToString(dr["CityCode"]); ent.CityName = MyConvert.ToString(dr["CityName"]); ent.ProvinceId = MyConvert.ToInt(dr["ProvinceId"]); }