public SYS_Region_Province SelectSYS_Region_Province(int ID) { SYS_Region_Province sys_region_province = new SYS_Region_Province(); DbDataReader reader = null; DbConnection conn = _DbHelper.CreateConnection(Common.ConnectionString); conn.Open(); try { List <DbParameter> para = new List <DbParameter>(); para.Add(_DbHelper.CreateParameter(FIELD_ID, ID, false)); reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_Region_Province_SelectById]", para.ToArray()); if (reader.HasRows && reader.Read()) { SYS_Region_ProvinceDataAccess.SetSYS_Region_ProvinceInfo(reader, ref sys_region_province); } return(sys_region_province); } catch (Exception ex) { throw new Exception(String.Format("SYS_Region_ProvinceDataAccess.SelectById: {0}", ex.Message)); } finally { if (reader != null) { reader.Close(); } conn.Close(); } }
private static void SetListSYS_Region_ProvinceInfo(ref DbDataReader reader, ref List <SYS_Region_Province> sys_region_provinces) { SYS_Region_Province sys_region_province = null; while (reader.Read()) { sys_region_province = new SYS_Region_Province(); SYS_Region_ProvinceDataAccess.SetSYS_Region_ProvinceInfo(reader, ref sys_region_province); sys_region_provinces.Add(sys_region_province); } }