当前位置: 首页>>代码示例>>C#>>正文


C# IDataReader.GetByte方法代码示例

本文整理汇总了C#中IDataReader.GetByte方法的典型用法代码示例。如果您正苦于以下问题:C# IDataReader.GetByte方法的具体用法?C# IDataReader.GetByte怎么用?C# IDataReader.GetByte使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDataReader的用法示例。


在下文中一共展示了IDataReader.GetByte方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Read

        public static SocialEntry Read(Int64 character, IDataReader reader, SocialType type)
        {
            if (!reader.Read())
                return null;

            SocialEntry entry;

            if (type == SocialType.Enemy)
            {
                var eentry = new EnemyEntry
                {
                    Race = reader.GetByte(1)
                };
                //eentry.TimesKilled = reader.GetByte("TimesKilled");
                //eentry.TimesKilledBy = reader.GetByte("TimesKilledBy");

                entry = eentry;
            }
            else
                entry = new SocialEntry();

            entry.Character = character;
            entry.OtherCharacter = reader.GetInt64(0);
            entry.Level = reader.GetByte(3);
            entry.LastContinentId = reader.GetUInt32(4);
            entry.Class = reader.GetByte(2);
            entry.Online = false;
            entry.Name = reader.GetString(5);
            entry.Type = (SocialType)reader.GetByte(6);

            return entry;
        }
开发者ID:4ptiv4,项目名称:GenesisSharp,代码行数:32,代码来源:SocialEntry.cs

示例2: FillTemplateFromReader

        internal static Template FillTemplateFromReader(IDataReader reader)
        {
            var template = new Template();

            if (reader != null && !reader.IsClosed)
            {
                DataTable dt = reader.GetSchemaTable();

                if (dt.Select("ColumnName='" + "CommandId" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("CommandId")))
                        template.TemplateId = reader.GetInt16(reader.GetOrdinal("CommandId"));
                if (dt.Select("ColumnName='" + "Name" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("Name")))
                        template.Name = reader.GetString(reader.GetOrdinal("Name"));
                if (dt.Select("ColumnName='" + "Description" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("Description")))
                        template.Description = reader.GetString(reader.GetOrdinal("Description"));
                if (dt.Select("ColumnName='" + "CannedCommand" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("CannedCommand")))
                        template.CannedCommand = reader.GetByte(reader.GetOrdinal("CannedCommand"));
                if (dt.Select("ColumnName='" + "AppName" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("AppName")))
                        template.AppName = reader.GetString(reader.GetOrdinal("AppName"));
                if (dt.Select("ColumnName='" + "Params" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("Params")))
                        template.Params = reader.GetString(reader.GetOrdinal("Params"));
                if (dt.Select("ColumnName='" + "UseCommandShell" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("UseCommandShell")))
                        template.UseCommandShell = reader.GetByte(reader.GetOrdinal("UseCommandShell"));
                if (dt.Select("ColumnName='" + "TimeoutDurationSecs" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("TimeoutDurationSecs")))
                        template.TimeoutDurationSecs = reader.GetInt16(reader.GetOrdinal("TimeoutDurationSecs"));
                if (dt.Select("ColumnName='" + "UserId" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("UserId")))
                        template.UserId = reader.GetInt16(reader.GetOrdinal("UserId"));
                if (dt.Select("ColumnName='" + "WaitInterval" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("WaitInterval")))
                        template.WaitInterval = reader.GetInt16(reader.GetOrdinal("WaitInterval"));
                if (dt.Select("ColumnName='" + "InvokeCategory" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("InvokeCategory")))
                        template.InvokeCategory = reader.GetString(reader.GetOrdinal("InvokeCategory"));
                if (dt.Select("ColumnName='" + "InvokeItemName" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("InvokeItemName")))
                        template.InvokeItemName = reader.GetString(reader.GetOrdinal("InvokeItemName"));
                if (dt.Select("ColumnName='" + "CommandResultTestPatternText" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("CommandResultTestPatternText")))
                        template.CommandResultTestPatternText = reader.GetString(reader.GetOrdinal("CommandResultTestPatternText"));
                if (dt.Select("ColumnName='" + "CommandResultTestPatternType" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("CommandResultTestPatternType")))
                        template.CommandResultTestPatternType = reader.GetInt16(reader.GetOrdinal("CommandResultTestPatternType"));
                if (dt.Select("ColumnName='" + "CommandMenuGroupId" + "'").Length > 0)
                    if (!reader.IsDBNull(reader.GetOrdinal("CommandMenuGroupId")))
                        template.CommandMenuGroupId = reader.GetInt16(reader.GetOrdinal("CommandMenuGroupId"));

            }

            return template;
        }
开发者ID:ashishquovantis,项目名称:esqcd,代码行数:58,代码来源:EntityMapper.cs

示例3: Read

        public static SectorServerData Read(IDataReader reader)
        {
            if (reader.Read())
            {
                return new SectorServerData
                {
                    Id             = reader.GetByte(0),
                    Address        = IPAddress.Parse(reader.GetString(1)),
                    Port           = reader.GetUInt16(2),
                    CurrentPlayers = reader.GetUInt16(3),
                    Status         = reader.GetByte(4),
                };
            }

            return null;
        }
开发者ID:4ptiv4,项目名称:GenesisSharp,代码行数:16,代码来源:SectorServerData.cs

示例4: getByte

        protected static byte getByte(IDataReader dataReader, int column)
        {
            if (!dataReader.IsDBNull(column))
                return (byte)dataReader.GetByte(column);

            return 0;
        }
开发者ID:Letractively,项目名称:rpcwc,代码行数:7,代码来源:RPCWCDAO.cs

示例5: GetByte

        public static byte GetByte(IDataReader dr, string columnName)
        {
            int ordinal = dr.GetOrdinal(columnName);
            bool isDbNull = dr.IsDBNull(ordinal);

            return isDbNull ? default(byte) : dr.GetByte(ordinal);
        }
开发者ID:aserdaray,项目名称:Projects,代码行数:7,代码来源:DataExtractor.cs

示例6: GetByteValueFromRs

    public static byte GetByteValueFromRs(IDataReader r, String columnName)
    {
        byte val = 0;
        try {
            if (r.GetString(r.GetOrdinal(columnName)) != null) {
                val = r.GetByte(r.GetOrdinal(columnName));
            }
        }
        catch (SqlException sqle) {

        }
        return val;
    }
开发者ID:CedricRup,项目名称:AtelierLegacyCodeCSharp,代码行数:13,代码来源:FactoryUtils.cs

示例7: GetEffectivePermissions

        internal static Dictionary<long, Dictionary<string, byte>> GetEffectivePermissions(IDataReader reader)
        {
            Dictionary<long, Dictionary<string, byte>> nivelPermissoes = new Dictionary<long, Dictionary<string, byte>>();
            Dictionary<string, byte> permisssaoPorTipoOperacao;
            long nivelID;
            while (reader.Read())
            {
                nivelID = reader.GetInt64(0);
                if (!nivelPermissoes.ContainsKey(nivelID))
                {
                    permisssaoPorTipoOperacao = new Dictionary<string, byte>();
                    if (!reader.IsDBNull(2)) permisssaoPorTipoOperacao.Add(reader.GetName(2), reader.GetByte(2));
                    if (!reader.IsDBNull(3)) permisssaoPorTipoOperacao.Add(reader.GetName(3), reader.GetByte(3));
                    if (!reader.IsDBNull(4)) permisssaoPorTipoOperacao.Add(reader.GetName(4), reader.GetByte(4));
                    if (!reader.IsDBNull(5)) permisssaoPorTipoOperacao.Add(reader.GetName(5), reader.GetByte(5));
                    if (!reader.IsDBNull(6)) permisssaoPorTipoOperacao.Add(reader.GetName(6), reader.GetByte(6));
                    

                    nivelPermissoes.Add(nivelID, permisssaoPorTipoOperacao);
                }
            }
            reader.Close();
            return nivelPermissoes;
        }
开发者ID:aureliopires,项目名称:gisa,代码行数:24,代码来源:PermissoesRule.cs

示例8: Read

        public static AccountData Read(IDataReader reader)
        {
            if (!reader.Read())
                return null;

            return new AccountData
            {
                Id             = reader.GetUInt64(0),
                UserName       = reader.GetString(1),
                Password       = reader.GetString(2),
                OneTimeKey     = reader.GetUInt32(3),
                Level          = reader.GetByte(4),
                FirstTimeFlags = new[] { reader.GetUInt32(5), reader.GetUInt32(6), reader.GetUInt32(7), reader.GetUInt32(8) }
            };
        }
开发者ID:4ptiv4,项目名称:GenesisSharp,代码行数:15,代码来源:AccountData.cs

示例9: ConvertFromDbValue

        /// <summary>
        /// Converts value at the specified index in the IDataReader into an instance of the specified type.
        /// </summary>
        /// <param name="reader">The IDataReader containing the results.</param>
        /// <param name="index">The index of the record to read from the IDataReader.</param>
        /// <param name="type">The type to convert result value to.</param>
        /// <returns>An instance of the specified type containing the specified value.</returns>
        public object ConvertFromDbValue(IDataReader reader, int index, Type type)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            if (reader.IsDBNull(index))
            {
                return null;
            }

            object enumValue;

            var enumType = TypeConverter.ResolveActualType(type);

            var enumStorageType = Enum.GetUnderlyingType(enumType);

            switch (enumStorageType.Name)
            {
                case "Byte":
                    enumValue = Enum.ToObject(enumType, reader.GetByte(index));
                    break;

                case "Int16":
                    enumValue = Enum.ToObject(enumType, reader.GetInt16(index));
                    break;

                case "Int32":
                    enumValue = Enum.ToObject(enumType, reader.GetInt32(index));
                    break;

                case "Int64":
                    enumValue = Enum.ToObject(enumType, reader.GetInt64(index));
                    break;

                default:
                    enumValue = Enum.ToObject(enumType, reader[0]);
                    break;
            }

            return enumValue;
        }
开发者ID:TrevorPilley,项目名称:MicroLite,代码行数:55,代码来源:EnumTypeConverter.cs

示例10: GetByte

 public byte GetByte(IDataReader reader, byte nullValue)
 {
     InitColumn(reader);
     if (reader.IsDBNull(Ordinal))
     {
         return nullValue;
     }
     else
     {
         return reader.GetByte(Ordinal);
     }
 }
开发者ID:ylux587,项目名称:FindHomeMadeFoodNearMe,代码行数:12,代码来源:SqlColumnBinder.cs

示例11: GetValue

		public virtual object GetValue (IDataReader rdr, int columnIndex) 
		{
		
			object value = null;
			
			if (rdr.IsDBNull (columnIndex))
				return null;
		
			Type type = rdr.GetFieldType (columnIndex);
			
			switch (type.Name.ToLower ()) {
		
			case "byte"    : value = rdr.GetByte (columnIndex);
					break;
			case "sbyte"   : value = rdr.GetInt16 (columnIndex);
					break;
			case "boolean" : value = rdr.GetBoolean (columnIndex);
					break;
			case "int16"   : value = rdr.GetInt16 (columnIndex);
					break;
			case "uint16"  : 
			case "int32"   : value = rdr.GetInt32 (columnIndex);
					break;
			case "uint32"  : 
			case "int64"   : value = rdr.GetInt64 (columnIndex);
					break;
			case "single"  : value = rdr.GetFloat (columnIndex);
					break;
			case "double"  : value = rdr.GetDouble (columnIndex);
					break;
			case "uint64"  : 
			case "decimal" : value = rdr.GetDecimal (columnIndex);
					break;
			case "datetime": value = rdr.GetDateTime (columnIndex);
					break;
			case "string": value = rdr.GetString (columnIndex);
					break;
			default :      value = rdr.GetValue (columnIndex);
					break;
			}
		
			return value;
		
		}
开发者ID:nlhepler,项目名称:mono,代码行数:44,代码来源:DataAdapterBaseTest.cs

示例12: FillUserControlPermission

        public static UserControlPermission FillUserControlPermission(IDataReader arg)
        {
            string output = "";
            output += arg.FieldCount + " ";
            

            UserControlPermission ucp = new UserControlPermission();
            ucp.Control = arg.GetString(0);
            ucp.AccessValue = arg.GetByte(1) == (byte)1 ? true : false;

            return ucp;
        }
开发者ID:Mr0Cake,项目名称:Permission-Granter,代码行数:12,代码来源:PermissionsBLL.cs

示例13: GetNullableByteFromReader

        static int? GetNullableByteFromReader(IDataReader reader, int index)
        {
            if (reader.IsDBNull(index)) return null;

            return reader.GetByte(index);
        }
开发者ID:gregorypilar,项目名称:interlace,代码行数:6,代码来源:Table.cs

示例14: LoadAssignments

        private IList<Assignment> LoadAssignments(IDataReader reader, bool loadStatus)
        {

            //string statusQuery = @"LoadSubscriptions";

            IList<Assignment> assignments = new List<Assignment>();
            while (reader.Read())
            {
                Status status = null;
                if (loadStatus)
                {
                    char? section = null;
                    if (reader.HasColumn("Section"))
                    {
                        var str = reader.GetString(reader.GetOrdinal("Section"));
                        if (!String.IsNullOrEmpty(str))
                            section = str[0];
                    }
                    byte? sectionSequence = reader.GetByte("SectionSequence");
                    if (section.HasValue && sectionSequence.HasValue)
                        status = new Status(Translator.FromDBValueToStatusType(section.Value), sectionSequence.Value);
                }

                Assignment assignment = GetAssignment(reader, status);
                assignments.Add(assignment);
                var id = reader.GetInt64("Id");
                if (id.HasValue)
                    _IdsByHashCode[assignment.GetHashCode()] = (int)id.Value;
            }

            return assignments;
        }
开发者ID:zeldafreak,项目名称:Area51,代码行数:32,代码来源:AssignmentRepositorycs.cs

示例15: FillUserPermission

 public static UserPermission FillUserPermission(IDataReader sq)
 {
     string output = sq.FieldCount.ToString();
     UserPermission perm = new UserPermission();
     perm.Control = sq.GetString(0);
     perm.AccessValue = sq.GetByte(1) == (byte)1 ? true : false;
     if (sq.FieldCount > 2)
     perm.Permission = sq.IsDBNull(2) ? "" : sq.GetString(2);
     return perm;
 }
开发者ID:Mr0Cake,项目名称:Permission-Granter,代码行数:10,代码来源:PermissionsBLL.cs


注:本文中的IDataReader.GetByte方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。