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


C# SqlDataReader.GetInt64方法代码示例

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


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

示例1: LoadFromDataReader

        /// <summary>
        /// Loads the entity from a <b>SqlDataReader</b> object.
        /// </summary>
        /// <param name="dr">The data reader to read from.</param>
        /// <returns>Returns the number of columns read.</returns>
        /// <remarks>
        /// Always reads at the current cursor position, doesn't calls the <b>Read</b> function
        /// on the <b>SqlDataReader</b> object. Reads data columns by their ordinal position in
        /// the query and not by their names.
        /// </remarks>
        internal override int LoadFromDataReader(SqlDataReader dr)
        {
            int o = base.LoadFromDataReader(dr);

            ++o;    // skip guid
            this.workflowTypeName = dr.GetString(++o);
            this.dateStarted = dr.IsDBNull(++o) ? DateTime.MinValue : dr.GetDateTime(o);
            this.dateFinished = dr.IsDBNull(++o) ? DateTime.MinValue : dr.GetDateTime(o);
            this.jobExecutionStatus = (JobExecutionState)dr.GetInt32(++o);
            this.suspendTimeout = dr.IsDBNull(++o) ? DateTime.MinValue : dr.GetDateTime(o);
            this.scheduleType = (ScheduleType)dr.GetInt32(++o);
            this.scheduleTime = dr.IsDBNull(++o) ? DateTime.MinValue : dr.GetDateTime(o);
            this.recurringPeriod = (RecurringPeriod)dr.GetInt32(++o);
            this.recurringInterval = dr.GetInt32(++o);
            this.recurringMask = dr.GetInt64(++o);
            this.workflowInstanceId = dr.IsDBNull(++o) ? Guid.Empty : dr.GetGuid(o);
            this.adminRequestTime = dr.IsDBNull(++o) ? DateTime.MinValue : dr.GetDateTime(o);
            if (!dr.IsDBNull(++o))
            {
                XmlSerializer ser = new XmlSerializer(typeof(JobAdminRequestData));
                StringReader sr = new StringReader(dr.GetString(o));
                this.adminRequestData = (JobAdminRequestData)ser.Deserialize(sr);
            }
            else
            {
                this.adminRequestData = null;
            }
            this.adminRequestResult = dr.GetInt32(++o);
            this.exceptionMessage = dr.IsDBNull(++o) ? null : dr.GetString(o);

            return o;
        }
开发者ID:horvatferi,项目名称:graywulf,代码行数:42,代码来源:JobInstance.io.cs

示例2: getItemKey

        protected override string getItemKey(SqlDataReader reader)
        {
            var userId = reader.GetInt64(0);
            var friendId = reader.GetInt64(1);

            return String.Format("{0}_{1}", userId, friendId);
        }
开发者ID:NewMediaCenterMoscow,项目名称:UniSocial3,代码行数:7,代码来源:VkFriendsDbObjectWriter.cs

示例3: LoginDB

        public LoginDB(System.Data.SqlClient.SqlDataReader reader)
        {
            this.reader = reader;
            this.ID = reader.GetInt64(reader.GetOrdinal("Id"));
            this.Login = reader.GetString(reader.GetOrdinal("Login"));
            this.Senha = reader.GetString(reader.GetOrdinal("Senha"));

        }
开发者ID:rogeriofabricio,项目名称:XamarinCursoCross,代码行数:8,代码来源:Login.cs

示例4: FillModelFrom

 private static void FillModelFrom(SqlDataReader reader, DeliveryAddressModel obj)
 {
     #region
     if (reader != null && !reader.IsClosed)
     {
         obj.DeliveryAddressID = reader.IsDBNull(reader.GetOrdinal("DeliveryAddressID")) ? 0 : reader.GetInt64(reader.GetOrdinal("DeliveryAddressID"));
         obj.UserID = reader.IsDBNull(reader.GetOrdinal("UserID")) ? 0 : reader.GetInt64(reader.GetOrdinal("UserID"));
         obj.Consignee = reader.IsDBNull(reader.GetOrdinal("Consignee")) ? String.Empty : reader.GetString(reader.GetOrdinal("Consignee"));
         obj.AreaID = reader.IsDBNull(reader.GetOrdinal("AreaID")) ? 0 : reader.GetInt32(reader.GetOrdinal("AreaID"));
         obj.CityID = reader.IsDBNull(reader.GetOrdinal("CityID")) ? 0 : reader.GetInt32(reader.GetOrdinal("CityID"));
         obj.Address = reader.IsDBNull(reader.GetOrdinal("Address")) ? String.Empty : reader.GetString(reader.GetOrdinal("Address"));
         obj.Postcode = reader.IsDBNull(reader.GetOrdinal("Postcode")) ? String.Empty : reader.GetString(reader.GetOrdinal("Postcode"));
         obj.Phone = reader.IsDBNull(reader.GetOrdinal("Phone")) ? String.Empty : reader.GetString(reader.GetOrdinal("Phone"));
         obj.Mobile = reader.IsDBNull(reader.GetOrdinal("Mobile")) ? String.Empty : reader.GetString(reader.GetOrdinal("Mobile"));
         obj.IsDefault = reader.IsDBNull(reader.GetOrdinal("IsDefault")) ? false : reader.GetBoolean(reader.GetOrdinal("IsDefault"));
     }
     #endregion
 }
开发者ID:yesnoba,项目名称:take-ticket-project,代码行数:18,代码来源:DeliveryAddressDAL.cs

示例5: Load

 internal static Message Load(SqlDataReader reader) {
     var message = new Message
                       {
                           ConversationGroupId = reader.GetGuid(0),
                           ConversationHandle = reader.GetGuid(1),
                           MessageSequenceNumber = reader.GetInt64(2),
                           ServiceName = reader.GetString(3),
                           ServiceContractName = reader.GetString(4),
                           MessageTypeName = reader.GetString(5),
                           Body = reader.IsDBNull(7) ? new byte[0] : reader.GetSqlBytes(7).Buffer
                       };
     return message;
 }
开发者ID:rmoritz,项目名称:servicebroker.net,代码行数:13,代码来源:Message.cs

示例6: FillModelFrom

 private static void FillModelFrom(SqlDataReader reader, UserInfoModel obj)
 {
     #region
     if (reader != null && !reader.IsClosed)
     {
         obj.UserID = reader.IsDBNull(reader.GetOrdinal("UserID")) ? 0 : reader.GetInt64(reader.GetOrdinal("UserID"));
         obj.Email = reader.IsDBNull(reader.GetOrdinal("Email")) ? String.Empty : reader.GetString(reader.GetOrdinal("Email"));
         obj.LoginName = reader.IsDBNull(reader.GetOrdinal("LoginName")) ? String.Empty : reader.GetString(reader.GetOrdinal("LoginName"));
         obj.Password = reader.IsDBNull(reader.GetOrdinal("Password")) ? String.Empty : reader.GetString(reader.GetOrdinal("Password"));
         obj.Sex = reader.IsDBNull(reader.GetOrdinal("Sex")) ? false : reader.GetBoolean(reader.GetOrdinal("Sex"));
         obj.Mobile = reader.IsDBNull(reader.GetOrdinal("Mobile")) ? String.Empty : reader.GetString(reader.GetOrdinal("Mobile"));
         obj.RealName = reader.IsDBNull(reader.GetOrdinal("RealName")) ? String.Empty : reader.GetString(reader.GetOrdinal("RealName"));
     }
     #endregion
 }
开发者ID:yesnoba,项目名称:take-ticket-project,代码行数:15,代码来源:UserInfoDAL.cs

示例7: Load

 internal static Message Load(SqlDataReader reader) {
     var message = new Message();
     //			RECEIVE conversation_group_id, conversation_handle, 
     //				message_sequence_number, service_name, service_contract_name, 
     //				message_type_name, validation, message_body
     //			FROM Queue
     message.ConversationGroupId = reader.GetGuid(0);
     message.ConversationHandle = reader.GetGuid(1);
     message.MessageSequenceNumber = reader.GetInt64(2);
     message.ServiceName = reader.GetString(3);
     message.ServiceContractName = reader.GetString(4);
     message.MessageTypeName = reader.GetString(5);
     //m_validation = reader.GetString(6);
     if (!reader.IsDBNull(7)) {
         message.Body = reader.GetSqlBytes(7).Buffer;
     } else
         message.Body = new byte[0];
     return message;
 }
开发者ID:abombss,项目名称:servicebroker.net,代码行数:19,代码来源:Message.cs

示例8: ReadDataRow

 private EventDataRow ReadDataRow(SqlDataReader eventReader)
 {
     return new EventDataRow
            {
                EventJson = eventReader.GetString(1),
                EventType = eventReader.GetInt32(0),
                AggregateRootId = eventReader.GetGuid(2),
                AggregateRootVersion = eventReader[3] as int? ?? eventReader.GetInt32(10),
                EventId = eventReader.GetGuid(4),
                UtcTimeStamp = DateTime.SpecifyKind(eventReader.GetDateTime(5), DateTimeKind.Utc),
                //Without this the datetime will be DateTimeKind.Unspecified and will not convert correctly into Local time....
                InsertionOrder = eventReader.GetInt64(6),
                InsertAfter = eventReader[7] as long?,
                InsertBefore = eventReader[8] as long?,
                Replaces = eventReader[9] as long?,
                InsertedVersion = eventReader.GetInt32(10),
                ManualVersion = eventReader[11] as int?,
                EffectiveVersion = eventReader[3] as int?
     };
 }
开发者ID:mlidbom,项目名称:Composable.Monolithic,代码行数:20,代码来源:SqlServerEventStoreEventReader.cs

示例9: LoadFromDataReader

        public int LoadFromDataReader(SqlDataReader dr)
        {
            int o = -1;

            this.eventId = dr.GetInt64(++o);
            this.userGuid = dr.GetGuid(++o);
            this.jobGuid = dr.GetGuid(++o);
            this.contextGuid = dr.GetGuid(++o);
            this.eventSource = (EventSource)dr.GetInt32(++o);
            this.eventSeverity = (EventSeverity)dr.GetInt32(++o);
            this.eventDateTime = dr.GetDateTime(++o);
            this.eventOrder = dr.GetInt64(++o);
            this.executionStatus = (ExecutionStatus)dr.GetInt32(++o);
            this.operation = dr.GetString(++o);
            this.entityGuid = dr.GetGuid(++o);
            this.entityGuidFrom = dr.GetGuid(++o);
            this.entityGuidTo = dr.GetGuid(++o);
            this.exceptionType = dr.IsDBNull(++o) ? null : dr.GetString(o);
            this.message = dr.IsDBNull(++o) ? null : dr.GetString(o);
            this.site = dr.IsDBNull(++o) ? null : dr.GetString(o);
            this.stackTrace = dr.IsDBNull(++o) ? null : dr.GetString(o);
            this.exception = null;

            return o;
        }
开发者ID:skyquery,项目名称:graywulf,代码行数:25,代码来源:Event.cs

示例10: ProcessSqlResult

        protected override Exception ProcessSqlResult(SqlDataReader reader)
        {
            Exception exception = StoreUtilities.GetNextResultSet(this.InstancePersistenceCommand.Name, reader);

            if (exception == null)
            {
                base.InstancePersistenceContext.BindInstanceOwner(this.lockOwnerId, this.lockOwnerId);
                long surrogateLockOwnerId = reader.GetInt64(1);

                // Activatable takes precendence over Runnable.  (Activation owners cannot run instances.)
                if (this.fireActivatableInstancesEvent)
                {
                    base.InstancePersistenceContext.BindEvent(HasActivatableWorkflowEvent.Value);
                }
                else if (this.fireRunnableInstancesEvent)
                {
                    base.InstancePersistenceContext.BindEvent(HasRunnableWorkflowEvent.Value);
                }

                base.StoreLock.MarkInstanceOwnerCreated(this.lockOwnerId, surrogateLockOwnerId, base.InstancePersistenceContext.InstanceHandle, this.fireRunnableInstancesEvent, this.fireActivatableInstancesEvent);
            }

            return exception;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:24,代码来源:CreateWorkflowOwnerAsyncResult.cs

示例11: ProcessSqlResult

 protected override Exception ProcessSqlResult(SqlDataReader reader)
 {
     Exception nextResultSet = StoreUtilities.GetNextResultSet(base.InstancePersistenceCommand.Name, reader);
     if (nextResultSet == null)
     {
         Guid instanceId = reader.GetGuid(1);
         reader.GetInt64(2);
         byte[] primitiveDataProperties = reader.IsDBNull(3) ? null : ((byte[]) reader.GetValue(3));
         byte[] complexDataProperties = reader.IsDBNull(4) ? null : ((byte[]) reader.GetValue(4));
         byte[] serializedMetadataProperties = reader.IsDBNull(5) ? null : ((byte[]) reader.GetValue(5));
         InstanceEncodingOption @byte = (InstanceEncodingOption) reader.GetByte(6);
         InstanceEncodingOption instanceEncodingOption = (InstanceEncodingOption) reader.GetByte(7);
         long instanceVersion = reader.GetInt64(8);
         bool boolean = reader.GetBoolean(9);
         bool flag2 = reader.GetBoolean(10);
         InstancePersistenceCommand instancePersistenceCommand = base.InstancePersistenceCommand;
         LoadWorkflowByInstanceKeyCommand command = base.InstancePersistenceCommand as LoadWorkflowByInstanceKeyCommand;
         if (!base.InstancePersistenceContext.InstanceView.IsBoundToInstance)
         {
             base.InstancePersistenceContext.BindInstance(instanceId);
         }
         if (!base.InstancePersistenceContext.InstanceView.IsBoundToInstanceOwner)
         {
             base.InstancePersistenceContext.BindInstanceOwner(base.StoreLock.LockOwnerId, base.StoreLock.LockOwnerId);
         }
         if (!base.InstancePersistenceContext.InstanceView.IsBoundToLock)
         {
             ((InstanceLockTracking) base.InstancePersistenceContext.UserContext).TrackStoreLock(instanceId, instanceVersion, base.DependentTransaction);
             base.InstancePersistenceContext.BindAcquiredLock(instanceVersion);
         }
         this.instanceData = SerializationUtilities.DeserializePropertyBag(primitiveDataProperties, complexDataProperties, @byte);
         this.instanceMetadata = SerializationUtilities.DeserializeMetadataPropertyBag(serializedMetadataProperties, instanceEncodingOption);
         if (!flag2)
         {
             this.ReadInstanceMetadataChanges(reader, this.instanceMetadata);
             this.ReadKeyData(reader, this.associatedInstanceKeys, this.completedInstanceKeys);
         }
         else if (command != null)
         {
             foreach (KeyValuePair<Guid, IDictionary<XName, InstanceValue>> pair in command.InstanceKeysToAssociate)
             {
                 this.associatedInstanceKeys.Add(pair.Key, pair.Value);
             }
             if (!this.associatedInstanceKeys.ContainsKey(command.LookupInstanceKey))
             {
                 base.InstancePersistenceContext.AssociatedInstanceKey(command.LookupInstanceKey);
                 this.associatedInstanceKeys.Add(command.LookupInstanceKey, new Dictionary<XName, InstanceValue>());
             }
         }
         if (command != null)
         {
             foreach (KeyValuePair<Guid, IDictionary<XName, InstanceValue>> pair2 in command.InstanceKeysToAssociate)
             {
                 base.InstancePersistenceContext.AssociatedInstanceKey(pair2.Key);
                 if (pair2.Value != null)
                 {
                     foreach (KeyValuePair<XName, InstanceValue> pair3 in pair2.Value)
                     {
                         base.InstancePersistenceContext.WroteInstanceKeyMetadataValue(pair2.Key, pair3.Key, pair3.Value);
                     }
                 }
             }
         }
         base.InstancePersistenceContext.LoadedInstance(boolean ? InstanceState.Initialized : InstanceState.Uninitialized, this.instanceData, this.instanceMetadata, this.associatedInstanceKeys, this.completedInstanceKeys);
         return nextResultSet;
     }
     if (nextResultSet is InstanceLockLostException)
     {
         base.InstancePersistenceContext.InstanceHandle.Free();
     }
     return nextResultSet;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:72,代码来源:LoadWorkflowAsyncResult.cs

示例12: ConvertFromRow

        private static MembershipEntry ConvertFromRow(SqlDataReader results, out string eTag, out int tableVersion, out string versionETag)
        {
            var entry = new MembershipEntry();

            int port = results.GetInt32(PortIdx);
            int gen = results.GetInt32(GenerationIdx);
            entry.SiloAddress = SiloAddress.New(new IPEndPoint(IPAddress.Parse(results.GetString(AddressIdx)), port), gen);

            entry.HostName = results.GetString(HostNameIdx);
            entry.Status = (SiloStatus)results.GetInt32(StatusIdx);
            if (!results.GetSqlInt32(ProxyPortIdx).IsNull)
                entry.ProxyPort = results.GetInt32(ProxyPortIdx);
            if (!results.GetSqlBoolean(PrimaryIdx).IsNull)
                entry.IsPrimary = results.GetBoolean(PrimaryIdx);

            entry.RoleName = results.GetString(RoleNameIdx);
            entry.InstanceName = results.GetString(InstanceNameIdx);
            if (!results.GetSqlInt32(UpdateZoneIdx).IsNull)
                entry.UpdateZone = results.GetInt32(UpdateZoneIdx);
            if (!results.GetSqlInt32(FaultZoneIdx).IsNull)
                entry.FaultZone = results.GetInt32(FaultZoneIdx);

            if (!results.GetSqlDateTime(StartTimeIdx).IsNull)
                entry.StartTime = results.GetDateTime(StartTimeIdx);
            if (!results.GetSqlDateTime(IAmAliveTimeIdx).IsNull)
                entry.IAmAliveTime = results.GetDateTime(IAmAliveTimeIdx);
            eTag = results.GetString(ETagIdx);
            tableVersion = (int)results.GetInt64(VersionIdx);
            versionETag = results.GetString(VersionETagIdx);

            var suspectingSilosString = results.GetSqlString(SuspectingSilosIdx);
            var suspectingTimesString = results.GetSqlString(SuspectingTimesIdx);

            List<SiloAddress> suspectingSilos = new List<SiloAddress>();
            List<DateTime> suspectingTimes = new List<DateTime>();
            if (!suspectingSilosString.IsNull && !string.IsNullOrEmpty(suspectingSilosString.Value))
            {
                string[] silos = suspectingSilosString.Value.Split('|');
                foreach (string silo in silos)
                {
                    suspectingSilos.Add(SiloAddress.FromParsableString(silo));
                }
            }

            if (!suspectingTimesString.IsNull && !string.IsNullOrEmpty(suspectingTimesString.Value))
            {
                string[] times = suspectingTimesString.Value.Split('|');
                foreach (string time in times)
                {
                    suspectingTimes.Add(TraceLogger.ParseDate(time));
                }
            }

            if (suspectingSilos.Count != suspectingTimes.Count)
                throw new OrleansException(String.Format("SuspectingSilos.Length of {0} as read from SQL table is not eqaul to SuspectingTimes.Length of {1}", suspectingSilos.Count, suspectingTimes.Count));

            for (int i = 0; i < suspectingSilos.Count; i++)
            {
                entry.AddSuspector(suspectingSilos[i], suspectingTimes[i]);
            }
            return entry;
        }
开发者ID:stanroze,项目名称:orleans,代码行数:62,代码来源:SqlMembershipTable.cs

示例13: ReadLookupTableRows

        private static void ReadLookupTableRows(LookupTable ratingTable, SqlDataReader reader)
        {
            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    var LookupTableRow = new LookupTableRow();
                    var index = 0;
                    LookupTableRow.RowId = reader.GetInt64(index++).ToString();
                    LookupTableRow.ChangeId = reader.GetGuid(index++).ToString();
                    LookupTableRow.EffectiveDate = reader.GetDateTime(index++);
                    LookupTableRow.Active = reader.GetBoolean(index++);

                    foreach (var key in ratingTable.Keys)
                    {
                        var value = reader.GetString(index);
                        if (value.Contains("::"))
                        {
                            var lhValues = value.Split("::".ToCharArray(),
                                                       StringSplitOptions.RemoveEmptyEntries);
                            LookupTableRow.KeyValues.Add(new LookupTableKey(lhValues[0],
                                                                            lhValues[1]));
                        }
                        else
                        {
                            LookupTableRow.KeyValues.Add(new LookupTableKey(value, null));
                        }

                        index++;
                    }
                    foreach (var column in ratingTable.Columns)
                    {
                        LookupTableRow.ColumnValues.Add(column.Name, reader.GetString(index));
                        index++;
                    }
                    ratingTable.Rows.Add(LookupTableRow);
                }
            }
        }
开发者ID:EmptyCubes,项目名称:More,代码行数:39,代码来源:FlatTableRatingConfigStrategy.cs

示例14: getFieldValue

 public static string getFieldValue(SqlDataReader dr, int ind, string def)
 {
     string val = def;
     if (!dr.IsDBNull(ind))
     {
         switch (System.Type.GetTypeCode(dr.GetFieldType(ind)))
         {
             case System.TypeCode.Boolean:
                 val = (dr.GetBoolean(ind) ? "1" : "0");
                 break;
             case System.TypeCode.Int16:
                 val = dr.GetInt16(ind).ToString();
                 break;
             case System.TypeCode.Int32:
                 val = dr.GetInt32(ind).ToString();
                 break;
             case System.TypeCode.Int64:
                 val = dr.GetInt64(ind).ToString();
                 break;
             case System.TypeCode.Single:
                 val = dr.GetFloat(ind).ToString();
                 break;
             case System.TypeCode.Double:
                 val = dr.GetDouble(ind).ToString();
                 break;
             case System.TypeCode.Decimal:
                 val = dr.GetDecimal(ind).ToString();
                 break;
             case System.TypeCode.DateTime:
                 val = DBManagerSQL.DBDateToFormatedDate(dr.GetDateTime(ind));
                 break;
             case System.TypeCode.String:
                 val = dr.GetString(ind);
                 break;
         }
     }
     return val;
 }
开发者ID:ranyaof,项目名称:gismaster,代码行数:38,代码来源:DBManagerSQL.cs

示例15: getRsInt64

 protected Int64 getRsInt64(SqlDataReader cReader, int idx)
 {
     try
     {
         if (cReader[idx] != null)
         {
             return cReader.GetInt64(idx);
         }
         else
         {
             return 0;
         }
     }
     catch
     {
         return 0;
     }
 }
开发者ID:yuta1011tokyo,项目名称:Liplis-Windows,代码行数:18,代码来源:BaseEntity.cs


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