System.Data.Common.DbDataReader.GetDateTime(int)

Here are the examples of the csharp api class System.Data.Common.DbDataReader.GetDateTime(int) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

31 Examples 7

1. Example

Project: EDDiscovery
Source File: SQLiteCommandED.cs
View license
public override DateTime GetDateTime(int ordinal) { return InnerReader.GetDateTime(ordinal); }

2. Example

Project: SharpSCADA
Source File: DataHelper.cs
View license
public static DateTime? GetNullableTime(this DbDataReader reader, int index)
        {
            return reader.GetDateTime(index);
        }

3. Example

Project: Glimpse
Source File: GlimpseDbDataReader.cs
View license
public override DateTime GetDateTime(int ordinal)
        {
            return InnerDataReader.GetDateTime(ordinal);
        }

4. Example

View license
public override DateTime GetDateTime(int i)
            {
                return reader.GetDateTime(i);
            }

5. Example

Project: ALinq
Source File: DataReader.cs
View license
public override DateTime GetDateTime(int ordinal)
        {
            //OracleDateTime dateTime = source.GetOracleDateTime(ordinal);
            //return dateTime.Value;
            return source.GetDateTime(ordinal);
        }

6. Example

Project: nhibernate-core
Source File: ResultSetWrapper.cs
View license
public override DateTime GetDateTime(int i)
		{
			return rs.GetDateTime(i);
		}

7. Example

View license
public override DateTime GetDateTime(int i)
		{
			return reader.GetDateTime(i);
		}

8. Example

View license
public override DateTime GetDateTime(int i)
		{
			return _reader.GetDateTime(i);
		}

9. Example

Project: NServiceKit
Source File: ProfiledDbDataReader.cs
View license
public override DateTime GetDateTime(int ordinal)
        {
            return _reader.GetDateTime(ordinal);
        }

10. Example

View license
public override DateTime GetDateTime(int ordinal)
        {
            return wrappedReader.GetDateTime(ordinal);
        }

11. Example

Project: EasyLOB
Source File: DbDataReaderExtensions.cs
View license
public static DateTime ToDateTime(this DbDataReader reader, int index)
        {
            return reader.IsDBNull(index) ? LibraryDefaults.Default_DateTime : reader.GetDateTime(index);
        }

12. Example

Project: EasyLOB
Source File: DbDataReaderExtensions.cs
View license
public static DateTime? ToDateTimeNullable(this DbDataReader reader, int index)
        {
            return reader.IsDBNull(index) ? (DateTime?)null : reader.GetDateTime(index);
        }

13. Example

Project: SharpSCADA
Source File: DataHelper.cs
View license
public static int GetTimeTick(this DbDataReader reader, int index)
        {
            var datetime = reader.GetDateTime(index);
            var value = datetime.Subtract(new DateTime(1900, 1, 1));
            long num2 = value.Ticks - value.Days * 864000000000;
            if (num2 < 0)
                num2 += 864000000000;
            int num3 = (int)(num2 / 10000.0 * 0.3 + 0.5);
            if (num3 > 300 * 60 * 60 * 24 - 1)
                num3 = 0;
            return num3;
        }

14. Example

Project: SharpSCADA
Source File: DataHelper.cs
View license
public static DateTime? GetNullableTime(this DbDataReader reader, int index)
        {
            SqlDataReader dataReader = reader as SqlDataReader;
            if (dataReader == null) return reader.GetDateTime(index);
            var svr = dataReader.GetSqlDateTime(index);
            return svr.IsNull ? default(Nullable<DateTime>) : svr.Value;
        }

15. Example

Project: logwizard
Source File: db_util.cs
View license
public static DateTime non_null_dt(DbDataReader rs, int idx) {
            return rs.IsDBNull(idx) ? DateTime.MinValue : rs.GetDateTime(idx);
        }

16. Example

Project: framework
Source File: FieldReader.cs
View license
public DateTime GetDateTime(int ordinal)
        {
            LastOrdinal = ordinal;
            DateTime dt;
            switch (typeCodes[ordinal])
            {
                case TypeCode.DateTime:
                    dt = reader.GetDateTime(ordinal);
                    break;
                default:
                    dt = ReflectionTools.ChangeType<DateTime>(reader.GetValue(ordinal));
                    break;
            }

            if (Schema.Current.TimeZoneMode == TimeZoneMode.Utc)
                return new DateTime(dt.Ticks, DateTimeKind.Utc);
            return dt; 
        }

17. Example

Project: SharpSCADA
Source File: DataHelper.cs
View license
public static int GetTimeTick(this DbDataReader reader, int index)
        {
            SqlDataReader dataReader = reader as SqlDataReader;
            if (dataReader != null)
            {
                return dataReader.GetSqlDateTime(index).TimeTicks;
            }
            var datetime = reader.GetDateTime(index);
            var value = datetime.Subtract(new DateTime(1900, 1, 1));
            long num2 = value.Ticks - value.Days * 864000000000;
            if (num2 < 0)
                num2 += 864000000000;
            int num3 = (int)(num2 / 10000.0 * 0.3 + 0.5);
            if (num3 > 300 * 60 * 60 * 24 - 1)
                num3 = 0;
            return num3;
        }

18. Example

Project: nhibernate-core
Source File: NullDateUserType.cs
View license
public object NullSafeGet(DbDataReader rs, string[] names, ISessionImplementor session, object owner)
		{
			int ordinal = rs.GetOrdinal(names[0]);
			if (rs.IsDBNull(ordinal))
			{
				return DateTime.MinValue;
			}
			else
			{
				return rs.GetDateTime(ordinal);
			}
		}

19. Example

View license
public override DateTime GetDateTime(int ordinal)
        {
            if (this.IsDBNull(ordinal))
                throw new SqlNullValueException(string.Format("Column contains {0} DBNull", ordinal));

            return _resultsReader.GetDateTime(ordinal);
        }

20. Example

Project: logwizard
Source File: database_table_reader.cs
View license
private log_entry_line line_from_reader() {
            log_entry_line row = new log_entry_line();

/n ..... /n //View Source file for more details /n }

21. Example

View license
private MembershipUser GetUserFromReader(DbDataReader reader)
        {
            object providerU/n ..... /n //View Source file for more details /n }

22. Example

Project: MimeKit
Source File: X509CertificateDatabase.cs
View license
X509CrlRecord LoadCrlRecord (DbDataReader reader, X509CrlParser parser, ref byte[] buffer)
		{
			var record = new X509CrlRecord ();

			for (int i = 0; i < reader.FieldCount; i++) {
				switch (reader.GetName (i).ToUpperInvariant ()) {
				case "CRL":
					record.Crl = DecodeX509Crl (reader, parser, i, ref buffer);
					break;
				case "THISUPDATE":
					record.ThisUpdate = DateTime.SpecifyKind (reader.GetDateTime (i), DateTimeKind.Utc);
					break;
				case "NEXTUPDATE":
					record.NextUpdate = DateTime.SpecifyKind (reader.GetDateTime (i), DateTimeKind.Utc);
					break;
				case "DELTA":
					record.IsDelta = reader.GetBoolean (i);
					break;
				case "ID":
					record.Id = reader.GetInt32 (i);
					break;
				}
			}

			return record;
		}

23. Example

Project: nhibernate-core
Source File: DbTimestampType.cs
View license
protected virtual async Task<DateTime> UsePreparedStatementAsync(string timestampSelectString, ISessionImplementor session, CancellationToken cancellationToken)
		{
			cancellationToken.ThrowIfCancellationRequested();
			var tsSelect = new SqlString(timestampSelectString);
			DbCommand ps = null;
			DbDataReader rs = null;
			using (session.BeginProcess())
			{
				try
				{
					ps = await (session.Batcher.PrepareCommandAsync(CommandType.Text, tsSelect, EmptyParams, cancellationToken)).ConfigureAwait(false);
					rs = await (session.Batcher.ExecuteReaderAsync(ps, cancellationToken)).ConfigureAwait(false);
					await (rs.ReadAsync(cancellationToken)).ConfigureAwait(false);
					var ts = rs.GetDateTime(0);
					log.DebugFormat("current timestamp retreived from db : {0} (ticks={1})", ts, ts.Ticks);
					return ts;
				}
				catch (DbException sqle)
				{
					throw ADOExceptionHelper.Convert(
						session.Factory.SQLExceptionConverter,
						sqle,
						"could not select current db timestamp",
						tsSelect);
				}
				finally
				{
					if (ps != null)
					{
						try
						{
							session.Batcher.CloseCommand(ps, rs);
						}
						catch (DbException sqle)
						{
							log.Warn("unable to clean up prepared statement", sqle);
						}
					}
				}
			}
		}

24. Example

Project: nhibernate-core
Source File: DbTimestampType.cs
View license
protected virtual DateTime UsePreparedStatement(string timestampSelectString, ISessionImplementor session)
		{
			var tsSelect = new SqlString(timestampSelectString);
			DbCommand ps = null;
			DbDataReader rs = null;
			using (session.BeginProcess())
			{
				try
				{
					ps = session.Batcher.PrepareCommand(CommandType.Text, tsSelect, EmptyParams);
					rs = session.Batcher.ExecuteReader(ps);
					rs.Read();
					var ts = rs.GetDateTime(0);
					log.DebugFormat("current timestamp retreived from db : {0} (ticks={1})", ts, ts.Ticks);
					return ts;
				}
				catch (DbException sqle)
				{
					throw ADOExceptionHelper.Convert(
						session.Factory.SQLExceptionConverter,
						sqle,
						"could not select current db timestamp",
						tsSelect);
				}
				finally
				{
					if (ps != null)
					{
						try
						{
							session.Batcher.CloseCommand(ps, rs);
						}
						catch (DbException sqle)
						{
							log.Warn("unable to clean up prepared statement", sqle);
						}
					}
				}
			}
		}

25. Example

View license
[HttpGet]
        public async Task<IActionResult> Index()
        {
            // [START exa/n ..... /n //View Source file for more details /n }

26. Example

Project: MimeKit
Source File: X509CertificateDatabase.cs
View license
X509CertificateRecord LoadCertificateRecord (DbDataReader reader, X509CertificateParser parser, ref byte[] buffer)
		{
			var record = new X509CertificateRecord ();

			for (int i = 0; i < reader.FieldCount; i++) {
				switch (reader.GetName (i).ToUpperInvariant ()) {
				case "CERTIFICATE":
					record.Certificate = DecodeCertificate (reader, parser, i, ref buffer);
					break;
				case "PRIVATEKEY":
					record.PrivateKey = DecodePrivateKey (reader, i, ref buffer);
					break;
				case "ALGORITHMS":
					record.Algorithms = DecodeEncryptionAlgorithms (reader, i);
					break;
				case "ALGORITHMSUPDATED":
					record.AlgorithmsUpdated = DateTime.SpecifyKind (reader.GetDateTime (i), DateTimeKind.Utc);
					break;
				case "TRUSTED":
					record.IsTrusted = reader.GetBoolean (i);
					break;
				case "ID":
					record.Id = reader.GetInt32 (i);
					break;
				}
			}

			return record;
		}

27. Example

Project: OrigoDB
Source File: SqlCommandStore.cs
View license
protected override IEnumerable<JournalEntry> GetJournalEntriesFromImpl(ulong entryId)
        {
            var connection = CreateConnection();
            var dbCommand = connection.CreateCommand();
            var parameter = dbCommand.CreateParameter();
            parameter.ParameterName = "@id";
            parameter.DbType = DbType.Int64;
            parameter.Value = entryId;
            dbCommand.Parameters.Add(parameter);
            dbCommand.CommandText = _statements.ReadEntries;
            connection.Open();
            using (connection)
            {
                var reader = dbCommand.ExecuteReader();
                while (reader.Read())
                {
                    var id = (ulong)reader.GetInt64(0);
                    var created = reader.GetDateTime(1);
                    var item = _formatter.FromByteArray<object>((byte[])reader[2]);
                    yield return JournalEntry.Create(id, created, item);
                }
                reader.Close();
            }
        }

28. Example

Project: nuodb-dotnet
Source File: TestFixture.cs
View license
[Test]
        public void TestTimeZone()
        {
            // Use a time in the UTC time zone; /n ..... /n //View Source file for more details /n }

29. Example

View license
private void UpdateFailureCount(string username, string failureType)
        {
            EnsureTab/n ..... /n //View Source file for more details /n }

30. Example

Project: framework
Source File: FieldReader.cs
View license
public string GetString(int ordinal)
        {
            LastOrdinal = ordinal;
            if (reader.IsDBNull(ordinal))
            {
                return null;
            }

            switch (typeCodes[ordinal])
            {
                case TypeCode.Byte:
                    return reader.GetByte(ordinal).ToString();
                case TypeCode.Int16:
                    return reader.GetInt16(ordinal).ToString();
                case TypeCode.Int32:
                    return reader.GetInt32(ordinal).ToString();
                case TypeCode.Int64:
                    return reader.GetInt64(ordinal).ToString();
                case TypeCode.Double:
                    return reader.GetDouble(ordinal).ToString();
                case TypeCode.Single:
                    return reader.GetFloat(ordinal).ToString();
                case TypeCode.Decimal:
                    return reader.GetDecimal(ordinal).ToString();
                case TypeCode.DateTime:
                    return reader.GetDateTime(ordinal).ToString();
                case tcGuid:
                    return reader.GetGuid(ordinal).ToString();
                case TypeCode.String:
                    return reader.GetString(ordinal);
                default:
                    return reader.GetValue(ordinal).ToString();
            }
        }

31. Example

View license
private Delegate GetValuesGetter(int ind, MemberInfo m)
			{
				var memberType = ReflectionUtils.Ge/n ..... /n //View Source file for more details /n }