示例#1
0
        public DM_MODULE SelectDM_MODULE(int IDMODULE)
        {
            DM_MODULE    dm_module = new DM_MODULE();
            DbDataReader reader    = null;
            DbConnection conn      = _DbHelper.CreateConnection(Common.ConnectionString);

            conn.Open();
            try
            {
                List <DbParameter> para = new List <DbParameter>();
                para.Add(_DbHelper.CreateParameter(FIELD_IDMODULE, IDMODULE, false));

                reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[DM_MODULE_SelectById]", para.ToArray());
                if (reader.HasRows && reader.Read())
                {
                    DM_MODULEDataAccess.SetDM_MODULEInfo(reader, ref dm_module);
                }
                return(dm_module);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("DM_MODULEDataAccess.SelectById: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                conn.Close();
            }
        }
示例#2
0
        private static void SetBindingListDM_MODULEInfo(ref DbDataReader reader, ref BindingList <DM_MODULE> dm_modules)
        {
            DM_MODULE dm_module = null;

            while (reader.Read())
            {
                dm_module = new DM_MODULE();
                DM_MODULEDataAccess.SetDM_MODULEInfo(reader, ref dm_module);
                dm_modules.Add(dm_module);
            }
        }