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


C# IDataReader.GetDouble方法代码示例

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


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

示例1: GetDouble

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

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

示例2: GetDoubleNullCheck

 public static double GetDoubleNullCheck(IDataReader reader, int ordinal)
 {
     try {
         return reader.IsDBNull(ordinal) ? 0 : reader.GetFieldType(ordinal).Name == "Double" ? reader.GetDouble(ordinal) : Convert.ToDouble(reader.GetString(ordinal));
     } catch (Exception) {
         return 0;
     }
 }
开发者ID:Josimar,项目名称:UpperCash,代码行数:8,代码来源:Utilities.cs

示例3: GetValueByIndex

        /// <summary>
        /// Gets a column value by the index
        /// </summary>
        /// <param name="mapping"></param>
        /// <param name="dataReader"></param>
        /// <returns></returns>
		public override object GetValueByIndex(ResultProperty mapping, IDataReader dataReader)
        {
            if (dataReader.IsDBNull(mapping.ColumnIndex))
			{
				return DBNull.Value;
			}
            return dataReader.GetDouble(mapping.ColumnIndex);
        }
开发者ID:techvenky,项目名称:mybatisnet,代码行数:14,代码来源:DoubleTypeHandler.cs

示例4: GetValueByName

        /// <summary>
        /// Gets a column value by the name
        /// </summary>
        /// <param name="mapping"></param>
        /// <param name="dataReader"></param>
        /// <returns></returns>
        public override object GetValueByName(ResultProperty mapping, IDataReader dataReader)
        {
            int index = dataReader.GetOrdinal(mapping.ColumnName);

            if (dataReader.IsDBNull(index))
            {
                return DBNull.Value;
            }
            return new double?(dataReader.GetDouble(index));
        }
开发者ID:techvenky,项目名称:mybatisnet,代码行数:16,代码来源:NullableDoubleTypeHandler.cs

示例5: GetDouble

 public static bool GetDouble(IDataReader reader, int nColumn, out double val)
 {
     try
     {
         val = reader.GetDouble(nColumn);
         return true;
     }
     catch (Exception)
     {
         val = double.NaN;
         return false;
     }
 }
开发者ID:BackupTheBerlios,项目名称:phpapi2db-svn,代码行数:13,代码来源:DataReader.cs

示例6: GetDouble

 public double GetDouble(IDataReader row, string field)
 {
     try
     {
         var i = GetField(row, field);
         if (row.IsDBNull(i)) return 0d;
         return row.GetDouble(i);
     }
     catch (Exception ex)
     {
         throw new Exception("BindingError: " + field, ex);
     }
 }
开发者ID:guylangston,项目名称:SokoSolve,代码行数:13,代码来源:DatabaseBinder.cs

示例7: DataReaderToList

        private IList<Venue> DataReaderToList(IDataReader reader)
        {
            var venues = new List<Venue>();

            while (reader.Read())
            {
                venues.Add(new Venue((int)reader.GetInt32(0),
                                     (string)reader.GetString(1),
                                     (int)reader.GetInt32(2),
                                     new Location((string)reader.GetString(3), (string)reader.GetString(4)),
                                     (double)reader.GetDouble(5),
                                     (double)reader.GetDouble(6)
                                     ));
            }

            return venues;
        }
开发者ID:amigobv,项目名称:UFO,代码行数:17,代码来源:VenueDao.cs

示例8: GetValueByName

        /// <summary>
        /// Gets a column value by the name
        /// </summary>
        /// <param name="mapping"></param>
        /// <param name="dataReader"></param>
        /// <returns></returns>
        public override object GetValueByName(ResultProperty mapping, IDataReader dataReader)
        {
            int index = dataReader.GetOrdinal(mapping.ColumnName);

            if (dataReader.IsDBNull(index) == true)
            {
                return System.DBNull.Value;
            }
            else
            {
                return dataReader.GetDouble(index);
            }
        }
开发者ID:hejiquan,项目名称:iBATIS_2010,代码行数:19,代码来源:DoubleTypeHandler.cs

示例9: LerAtributos

        protected virtual void LerAtributos(IDataReader leitor, int inicioAtributo)
        {
            codigo = (ulong)leitor.GetInt64(inicioAtributo);

            nome = leitor.GetString(inicioAtributo + 1);

            if (!leitor.IsDBNull(inicioAtributo + 2))
                setor = Setor.ObterSetor((uint)leitor.GetInt16(inicioAtributo + 2));

            if (leitor[inicioAtributo + 3] != DBNull.Value)
                email = leitor.GetString(inicioAtributo + 3);

            if (leitor[inicioAtributo + 4] != DBNull.Value)
                observações = leitor.GetString(inicioAtributo + 4);

            if (leitor[inicioAtributo + 5] != DBNull.Value)
                últimaVisita = leitor.GetDateTime(inicioAtributo + 5);

            if (leitor[inicioAtributo + 6] != DBNull.Value)
                dataRegistro = leitor.GetDateTime(inicioAtributo + 6);

            if (leitor[inicioAtributo + 7] != DBNull.Value)
                dataAlteração = leitor.GetDateTime(inicioAtributo + 7);

            classificações = (ulong)leitor.GetInt64(inicioAtributo + 8);

            if (leitor[inicioAtributo + 9] != DBNull.Value)
                maiorVenda = leitor.GetDouble(inicioAtributo + 9);

            if (leitor[inicioAtributo + 10] != DBNull.Value)
                crédito = leitor.GetDouble(inicioAtributo + 10);

            if (leitor[inicioAtributo + 11] != DBNull.Value)
                região = Região.ObterRegião((uint)leitor[inicioAtributo + 11]);

        }
开发者ID:andrepontesmelo,项目名称:imjoias,代码行数:36,代码来源:Pessoa.cs

示例10: GetDouble

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

示例11: DecodeExecutorFromDataReader

        private ExecutorStorageView[] DecodeExecutorFromDataReader(IDataReader dataReader)
        {
            ArrayList executors = new ArrayList();

            using(dataReader)
            {
                while(dataReader.Read())
                {
                    // in SQL the executor ID is stored as a GUID so we use GetValue instead of GetString in order to maximize compatibility with other databases
                    string executorId = dataReader.GetValue(dataReader.GetOrdinal("executor_id")).ToString();

                    bool dedicated = dataReader.GetBoolean(dataReader.GetOrdinal("is_dedicated"));
                    bool connected = dataReader.GetBoolean(dataReader.GetOrdinal("is_connected"));
                    DateTime pingTime = GetDateTime(dataReader, "ping_time");
                    string hostname = dataReader.GetString(dataReader.GetOrdinal("host"));
                    int port = dataReader.IsDBNull(dataReader.GetOrdinal("port")) ? 0 : dataReader.GetInt32(dataReader.GetOrdinal("port"));
                    string username = dataReader.GetString(dataReader.GetOrdinal("usr_name"));
                    int maxCpu = dataReader.IsDBNull(dataReader.GetOrdinal("cpu_max")) ? 0 : dataReader.GetInt32(dataReader.GetOrdinal("cpu_max"));
                    int cpuUsage = dataReader.IsDBNull(dataReader.GetOrdinal("cpu_usage")) ? 0 : dataReader.GetInt32(dataReader.GetOrdinal("cpu_usage"));
                    int availableCpu = dataReader.IsDBNull(dataReader.GetOrdinal("cpu_avail")) ? 0 : dataReader.GetInt32(dataReader.GetOrdinal("cpu_avail"));
                    float totalCpuUsage = dataReader.IsDBNull(dataReader.GetOrdinal("cpu_totalusage")) ? 0 : (float)dataReader.GetDouble(dataReader.GetOrdinal("cpu_totalusage"));

                    float maxMemory = dataReader.IsDBNull(dataReader.GetOrdinal("mem_max")) ? 0 : (float)dataReader.GetDouble(dataReader.GetOrdinal("mem_max"));;
                    float maxDisk = dataReader.IsDBNull(dataReader.GetOrdinal("disk_max")) ? 0 : (float)dataReader.GetDouble(dataReader.GetOrdinal("disk_max"));
                    int numberOfCpu = dataReader.IsDBNull(dataReader.GetOrdinal("num_cpus")) ? 0 : dataReader.GetInt32(dataReader.GetOrdinal("num_cpus"));
                    string os = dataReader.IsDBNull(dataReader.GetOrdinal("os")) ? "" : dataReader.GetString(dataReader.GetOrdinal("os"));
                    string architecture = dataReader.IsDBNull(dataReader.GetOrdinal("arch")) ? "" : dataReader.GetString(dataReader.GetOrdinal("arch"));

                    ExecutorStorageView executor = new ExecutorStorageView(
                        executorId,
                        dedicated,
                        connected,
                        pingTime,
                        hostname,
                        port,
                        username,
                        maxCpu,
                        cpuUsage,
                        availableCpu,
                        totalCpuUsage,
                        maxMemory,
                        maxDisk,
                        numberOfCpu,
                        os,
                        architecture
                        );

                    executors.Add(executor);
                }

                dataReader.Close();
            }

            return (ExecutorStorageView[])executors.ToArray(typeof(ExecutorStorageView));
        }
开发者ID:JamesTryand,项目名称:alchemi,代码行数:55,代码来源:GenericManagerDatabaseStorage.cs

示例12: GetJob

        private SyncJob GetJob(IDataReader reader)
        {
            var info = new SyncJob
            {
                Id = reader.GetGuid(0).ToString("N"),
                TargetId = reader.GetString(1),
                Name = reader.GetString(2)
            };

            if (!reader.IsDBNull(3))
            {
                info.Quality = (SyncQuality)Enum.Parse(typeof(SyncQuality), reader.GetString(3), true);
            }

            if (!reader.IsDBNull(4))
            {
                info.Status = (SyncJobStatus)Enum.Parse(typeof(SyncJobStatus), reader.GetString(4), true);
            }

            if (!reader.IsDBNull(5))
            {
                info.Progress = reader.GetDouble(5);
            }

            if (!reader.IsDBNull(6))
            {
                info.UserId = reader.GetString(6);
            }

            if (!reader.IsDBNull(7))
            {
                info.RequestedItemIds = reader.GetString(7).Split(',').ToList();
            }

            if (!reader.IsDBNull(8))
            {
                info.UnwatchedOnly = reader.GetBoolean(8);
            }

            if (!reader.IsDBNull(9))
            {
                info.Limit = reader.GetInt64(9);
            }

            if (!reader.IsDBNull(10))
            {
                info.LimitType = (SyncLimitType)Enum.Parse(typeof(SyncLimitType), reader.GetString(10), true);
            }

            info.IsDynamic = reader.GetBoolean(11);
            info.DateCreated = reader.GetDateTime(12).ToUniversalTime();
            info.DateLastModified = reader.GetDateTime(13).ToUniversalTime();
            info.ItemCount = reader.GetInt32(14);

            return info;
        }
开发者ID:jmarsh0507,项目名称:MediaBrowser,代码行数:56,代码来源:SyncRepository.cs

示例13: PreencherAtributos

        protected override void PreencherAtributos(IDataReader leitor, int inicioAtributosPagamento, int inicioAtributosEspecifico)
        {
            base.PreencherAtributos(leitor, inicioAtributosPagamento, inicioAtributosEspecifico);

            peso = leitor.GetDouble(inicioAtributosEspecifico + 1);
            paraFundir = leitor.GetBoolean(inicioAtributosEspecifico + 2);
            multiplicador = leitor.GetDouble(inicioAtributosEspecifico + 3);
            cotacao = leitor.GetDouble(inicioAtributosEspecifico + 4);
        }
开发者ID:andrepontesmelo,项目名称:imjoias,代码行数:9,代码来源:Ouro.cs

示例14: ConvertToPrice

 private Price ConvertToPrice(IDataReader reader)
 {
     return new Price
     {
         Id = reader.GetGuid(reader.GetOrdinal("GUID_RECORD")),
         ProductId = reader.GetGuid(reader.GetOrdinal("ITEM_GUID")),
         ProductPrice = reader.GetDouble(reader.GetOrdinal("PRICE")),
     };
 }
开发者ID:SergeyDushkin,项目名称:test,代码行数:9,代码来源:PriceService.cs

示例15: ReadRow

        /// <summary>
        /// Read a row from the specified reader into the provided userData object
        /// </summary>
        /// <param name="reader"></param>
        private UserItemData ReadRow(IDataReader reader)
        {
            var userData = new UserItemData();

            userData.Key = reader.GetString(0);
            userData.UserId = reader.GetGuid(1);

            if (!reader.IsDBNull(2))
            {
                userData.Rating = reader.GetDouble(2);
            }

            userData.Played = reader.GetBoolean(3);
            userData.PlayCount = reader.GetInt32(4);
            userData.IsFavorite = reader.GetBoolean(5);
            userData.PlaybackPositionTicks = reader.GetInt64(6);

            if (!reader.IsDBNull(7))
            {
                userData.LastPlayedDate = reader.GetDateTime(7).ToUniversalTime();
            }

            return userData;
        }
开发者ID:Ceten,项目名称:MediaBrowser,代码行数:28,代码来源:SqliteUserDataRepository.cs


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