示例#1
0
        public SYS_CCU SelectSYS_CCU(int ID)
        {
            SYS_CCU      sys_ccu = new SYS_CCU();
            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_CCU_SelectById]", para.ToArray());
                if (reader.HasRows && reader.Read())
                {
                    SYS_CCUDataAccess.SetSYS_CCUInfo(reader, ref sys_ccu);
                }
                return(sys_ccu);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("SYS_CCUDataAccess.SelectById: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                conn.Close();
            }
        }
示例#2
0
        private static void SetBindingListSYS_CCUInfo(ref DbDataReader reader, ref BindingList <SYS_CCU> sys_ccus)
        {
            SYS_CCU sys_ccu = null;

            while (reader.Read())
            {
                sys_ccu = new SYS_CCU();
                SYS_CCUDataAccess.SetSYS_CCUInfo(reader, ref sys_ccu);
                sys_ccus.Add(sys_ccu);
            }
        }