Here are the examples of the csharp api class System.Data.Common.DbDataReader.Close() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
107 Examples
0
0
0
0
4. Example
View licenseprotected virtual void Dispose(bool disposing) { if (disposing) { Close(); } }
0
0
0
0
8. Example
View licensepublic override void Close() { if (_closed) throw new InvalidOperationException("already closed"); _closed = true; if (!_resultsReader.IsClosed) _resultsReader.Close(); }
0
9. Example
View licensepublic override void Close() { InnerReader.Close(); if (_txnlock != null) { _txnlock.CloseReader(); _txnlock = null; } }
0
10. Example
View licensepublic void Close() { if (_connection != null) { _connection.Close(); } if (_results != null) { _results.Close(); } }
0
0
12. Example
View licensepublic override void Close() { source.Close(); if (this.closeConnection != null) this.closeConnection(); }
0
13. Example
View licenseoverride public void Close() { // Make sure we explicitly closed the data record, since that's what // where using to track closed state. DataRecord.CloseExplicitly(); if (!_isClosed) { _isClosed = true; if (0 == DataRecord.Depth) { // If we're the root collection, we want to ensure the remainder of // the result column hierarchy is closed out, to avoid dangling // references to it, should it be reused. We also want to physically // close out the source reader as well. Shaper.Reader.Close(); } else { // For non-root collections, we have to consume all the data, or we'll // not be positioned propertly for what comes afterward. Consume(); } } if (NextResultShaperInfoEnumerator != null) { NextResultShaperInfoEnumerator.Dispose(); NextResultShaperInfoEnumerator = null; } }
0
14. Example
View licensepublic override void Close() { // this can occur when we're not profiling, but we've inherited from ProfiledDbCommand and are returning a // an unwrapped reader from the base command if (_reader != null) { _reader.Close(); } if (_profiler != null) { _profiler.ReaderFinish(this); } }
0
15. Example
View licensepublic override void Close() { this.CommitComposer(); this.wrappedDataReader.Close(); }
0
16. Example
View licensepublic override void Close() { if (MessageBroker != null) { MessageBroker.Publish( new CommandRowCountMessage(ConnectionId, CommandId, RowCount) .AsTimedMessage(TimeSpan.Zero)); } InnerDataReader.Close(); }
0
17. Example
View licensepublic IEnumerable<T> ReadCollection(DbDataReader reader, ObjectsChangeTracker changeTracker) { while (reader.Read()) { T result = MapUsingState(reader, reader); if (changeTracker != null) { changeTracker.RegisterObject(result); } yield return result; } reader.Close(); }
0
18. Example
View licenseprotected override void DoClose() { _initialized = false; if (_dataReader!= null) { _dataReader.Close(); } if (_command != null) { _command.Dispose(); } if (_connection != null) { _connection.Close(); } }
0
19. Example
View licensepublic X509CertificateRecord Find (X509Certificate certificate, X509CertificateRecordFields fields) { if (certificate == null) throw new ArgumentNullException (nameof (certificate)); using (var command = GetSelectCommand (certificate, fields)) { var reader = command.ExecuteReader (); try { if (reader.Read ()) { var parser = new X509CertificateParser (); var buffer = new byte[4096]; return LoadCertificateRecord (reader, parser, ref buffer); } } finally { #if NETSTANDARD reader.Dispose (); #else reader.Close (); #endif } } return null; }
0
20. Example
View licensepublic IEnumerable<X509Certificate> FindCertificates (IX509Selector selector) { using (var command = GetSelectCommand (selector, false, false, X509CertificateRecordFields.Certificate)) { var reader = command.ExecuteReader (); try { var parser = new X509CertificateParser (); var buffer = new byte[4096]; while (reader.Read ()) { var record = LoadCertificateRecord (reader, parser, ref buffer); if (selector == null || selector.Match (record.Certificate)) yield return record.Certificate; } } finally { #if NETSTANDARD reader.Dispose (); #else reader.Close (); #endif } } yield break; }
0
21. Example
View licensepublic IEnumerable<AsymmetricKeyParameter> FindPrivateKeys (IX509Selector selector) { using (var command = GetSelectCommand (selector, false, true, PrivateKeyFields)) { var reader = command.ExecuteReader (); try { var parser = new X509CertificateParser (); var buffer = new byte[4096]; while (reader.Read ()) { var record = LoadCertificateRecord (reader, parser, ref buffer); if (selector == null || selector.Match (record.Certificate)) yield return record.PrivateKey; } } finally { #if NETSTANDARD reader.Dispose (); #else reader.Close (); #endif } } yield break; }
0
22. Example
View licensepublic IEnumerable<X509CertificateRecord> Find (MailboxAddress mailbox, DateTime now, bool requirePrivateKey, X509CertificateRecordFields fields) { if (mailbox == null) throw new ArgumentNullException (nameof (mailbox)); using (var command = GetSelectCommand (mailbox, now, requirePrivateKey, fields)) { var reader = command.ExecuteReader (); try { var parser = new X509CertificateParser (); var buffer = new byte[4096]; while (reader.Read ()) { yield return LoadCertificateRecord (reader, parser, ref buffer); } } finally { #if NETSTANDARD reader.Dispose (); #else reader.Close (); #endif } } yield break; }
0
23. Example
View licensepublic IEnumerable<X509CertificateRecord> Find (IX509Selector selector, bool trustedOnly, X509CertificateRecordFields fields) { using (var command = GetSelectCommand (selector, trustedOnly, false, fields | X509CertificateRecordFields.Certificate)) { var reader = command.ExecuteReader (); try { var parser = new X509CertificateParser (); var buffer = new byte[4096]; while (reader.Read ()) { var record = LoadCertificateRecord (reader, parser, ref buffer); if (selector == null || selector.Match (record.Certificate)) yield return record; } } finally { #if NETSTANDARD reader.Dispose (); #else reader.Close (); #endif } } yield break; }
0
24. Example
View licensepublic IEnumerable<X509CrlRecord> Find (X509Name issuer, X509CrlRecordFields fields) { if (issuer == null) throw new ArgumentNullException (nameof (issuer)); using (var command = GetSelectCommand (issuer, fields)) { var reader = command.ExecuteReader (); try { var parser = new X509CrlParser (); var buffer = new byte[4096]; while (reader.Read ()) { yield return LoadCrlRecord (reader, parser, ref buffer); } } finally { #if NETSTANDARD reader.Dispose (); #else reader.Close (); #endif } } yield break; }
0
25. Example
View licensepublic X509CrlRecord Find (X509Crl crl, X509CrlRecordFields fields) { if (crl == null) throw new ArgumentNullException (nameof (crl)); using (var command = GetSelectCommand (crl, fields)) { var reader = command.ExecuteReader (); try { if (reader.Read ()) { var parser = new X509CrlParser (); var buffer = new byte[4096]; return LoadCrlRecord (reader, parser, ref buffer); } } finally { #if NETSTANDARD reader.Dispose (); #else reader.Close (); #endif } } return null; }
0
26. Example
View licenseprotected virtual int FindVersion(DbConnection conn, string type) { int version = 0; using (DbCommand cmd = conn.CreateCommand()) { try { cmd.CommandText = "select version from migrations where name='" + type + "' order by version desc"; using (DbDataReader reader = cmd.ExecuteReader()) { if (reader.Read()) { version = Convert.ToInt32(reader["version"]); } reader.Close(); } } catch { // Something went wrong (probably no table), so we're at version -1 version = -1; } } return version; }
0
27. Example
View licenseprotected virtual int FindVersion(DbConnection conn, string type) { int version = 0; using (DbCommand cmd = conn.CreateCommand()) { try { cmd.CommandText = "select version from migrations where name='" + type + "' order by version desc"; using (DbDataReader reader = cmd.ExecuteReader()) { if (reader.Read()) { version = Convert.ToInt32(reader["version"]); } reader.Close(); } } catch { // Something went wrong (probably no table), so we're at version -1 version = -1; } } return version; }
0
28. Example
View licenseprotected virtual int FindVersion(DbConnection conn, string type) { int version = 0; using (DbCommand cmd = conn.CreateCommand()) { try { cmd.CommandText = "select version from migrations where name='" + type + "' order by version desc"; using (DbDataReader reader = cmd.ExecuteReader()) { if (reader.Read()) { version = Convert.ToInt32(reader["version"]); } reader.Close(); } } catch { // Something went wrong (probably no table), so we're at version -1 version = -1; } } return version; }
0
29. Example
View licensepublic static NDataReader Create(DbDataReader reader, bool isMidstream) { var dataReader = new NDataReader(); var resultList = new List<NResult>(2); try { // if we are in midstream of processing a DataReader then we are already // positioned on the first row (index=0) if (isMidstream) { dataReader.currentRowIndex = 0; } // there will be atleast one result resultList.Add(NResult.Create(reader, isMidstream)); while (reader.NextResult()) { // the second, third, nth result is not processed midstream resultList.Add(NResult.Create(reader, false)); } dataReader.results = resultList.ToArray(); } catch (Exception e) { throw new ADOException("There was a problem converting an DbDataReader to NDataReader", e); } finally { reader.Close(); } return dataReader; }
0
30. Example
View license[Test] public void TestCommand1() { using (NuoDbConnection connection = new NuoDbConnection(connectionString)) { DbCommand command = new NuoDbCommand("select * from hockey", connection); connection.Open(); DbDataReader reader = command.ExecuteReader(); while (reader.Read()) { Console.WriteLine("\t{0}\t{1}\t{2}\t{3}", reader[0], reader[1], reader[2], reader["id"]); } reader.Close(); } }
0
31. Example
View licensepublic async Task<dynamic> Documento(int id) { using (Banco banco = new Banco()) { /n ..... /n //View Source file for more details /n }
0
32. Example
View licensepublic async Task<dynamic> DocumentosDoMesmoDia(int id) { using (Banco banco = new Banco(/n ..... /n //View Source file for more details /n }
0
33. Example
View licensepublic async Task<dynamic> DocumentosDaSubcotaMes(int id) { using (Banco banco = new Banc/n ..... /n //View Source file for more details /n }
0
34. Example
View licensepublic DataTable ReadData(DatasetConfig datasetConfig, string filter, long Start, int Count, DateTime? Fromdate, DateTime? ToDate) { try { CheckAndEstablishReadConnection(); readCmd.Connection = readDBConn; readCmd.CommandText = "SELECT * FROM " + datasetConfig.Name + " LIMIT " + Count.ToString() + " OFFSET " + Start.ToString(); DbDataReader akReader = readCmd.ExecuteReader(); DataTable myTbl = new DataTable(); myTbl.Load(akReader); akReader.Close(); return myTbl; } catch (Exception ex) { } return null; }
0
35. Example
View licensepublic DataTable ReadData(DatasetConfig datasetConfig, string filter, long Start, int Count, DateTime? Fromdate, DateTime? ToDate) { try { CheckAndEstablishReadConnection(); readCmd.Connection = readDBConn; readCmd.CommandText = "SELECT * FROM " + datasetConfig.Name + " LIMIT " + Count.ToString() + " OFFSET " + Start.ToString(); DbDataReader akReader = readCmd.ExecuteReader(); DataTable myTbl = new DataTable(); myTbl.Load(akReader); akReader.Close(); return myTbl; } catch (Exception ex) { } return null; }
0
36. Example
View licensepublic IX509Store GetCrlStore () { var crls = new List<X509Crl> (); using (var command = GetSelectAllCrlsCommand ()) { var reader = command.ExecuteReader (); try { var parser = new X509CrlParser (); var buffer = new byte[4096]; while (reader.Read ()) { var record = LoadCrlRecord (reader, parser, ref buffer); crls.Add (record.Crl); } } finally { #if NETSTANDARD reader.Dispose (); #else reader.Close (); #endif } } return X509StoreFactory.Create ("Crl/Collection", new X509CollectionStoreParameters (crls)); }
0
37. Example
View license[Test] public void TestHighAvailability() { using (NuoDbConnection connection = new NuoDbConnection(connectionString.Replace("Server=", "Server=localhost:8,"))) { DbCommand command = new NuoDbCommand("select * from hockey", connection); connection.Open(); DbDataReader reader = command.ExecuteReader(); while (reader.Read()) { Console.WriteLine("\t{0}\t{1}\t{2}\t{3}", reader[0], reader[1], reader[2], reader["id"]); } reader.Close(); } }
0
38. Example
View licensepublic DataTable ReadData(DatasetConfig datasetConfig, string filter, long Start, int Count, DateTim/n ..... /n //View Source file for more details /n }
0
39. Example
View licensepublic DataTable ReadData(DatasetConfig datasetConfig, string sql, int Count) { //try { CheckAndEstablishReadConnection(); readCmd.Connection = readDBConn; readCmd.CommandText = sql.Trim(); if (readCmd.CommandText.EndsWith(";")) readCmd.CommandText = readCmd.CommandText.Substring(0, readCmd.CommandText.Length - 1); //if (!readCmd.CommandText.Contains("ORDER BY")) // readCmd.CommandText += " ORDER BY id DESC"; //if (!readCmd.CommandText.Contains("LIMIT") && !readCmd.CommandText.Contains("OFFSET")) // readCmd.CommandText += " LIMIT " + Count.ToString(); DbDataReader akReader = readCmd.ExecuteReader(); DataTable myTbl = new DataTable(); myTbl.Load(akReader); akReader.Close(); return myTbl; } //catch (Exception ex) { } return null; }
0
40. Example
View licensepublic DataTable ReadData(DatasetConfig datasetConfig, string filter, long Start, int Count, DateTim/n ..... /n //View Source file for more details /n }
0
41. Example
View licensepublic void ExecuteReader(string sql, Action<DbDataReader> action) { if (string.IsNullOrEmpty(sql)) throw new ArgumentNullException("sql", "A SQL query or stored procedure name is required"); Command.CommandText = sql; try { OpenConnection(); DbDataReader reader = null; try { reader = Command.ExecuteReader(); while (reader.Read()) { action(reader); } } finally { if (reader != null) reader.Close(); } } finally { CloseConnection(); } }
0
42. Example
View licensepublic static async Task<NDataReader> CreateAsync(DbDataReader reader, bool isMidstream, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); var dataReader = new NDataReader(); var resultList = new List<NResult>(2); try { // if we are in midstream of processing a DataReader then we are already // positioned on the first row (index=0) if (isMidstream) { dataReader.currentRowIndex = 0; } // there will be atleast one result resultList.Add(await (NResult.CreateAsync(reader, isMidstream, cancellationToken)).ConfigureAwait(false)); while (await (reader.NextResultAsync(cancellationToken)).ConfigureAwait(false)) { // the second, third, nth result is not processed midstream resultList.Add(await (NResult.CreateAsync(reader, false, cancellationToken)).ConfigureAwait(false)); } dataReader.results = resultList.ToArray(); } catch (Exception e) { throw new ADOException("There was a problem converting an DbDataReader to NDataReader", e); } finally { reader.Close(); } return dataReader; }
0
43. Example
View licensepublic virtual async Task<long> GetNextValueAsync(CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); _owner._accessCounter++; try { var st = await (_session.Batcher.PrepareCommandAsync(CommandType.Text, _owner._sql, SqlTypeFactory.NoTypes, cancellationToken)).ConfigureAwait(false); DbDataReader rs = null; try { rs = await (_session.Batcher.ExecuteReaderAsync(st, cancellationToken)).ConfigureAwait(false); try { await (rs.ReadAsync(cancellationToken)).ConfigureAwait(false); long result = Convert.ToInt64(rs.GetValue(0)); if (Log.IsDebugEnabled) { Log.Debug("Sequence value obtained: " + result); } return result; } finally { try { rs.Close(); } catch { // intentionally empty } } } finally { _session.Batcher.CloseCommand(st, rs); } } catch (DbException sqle) { throw ADOExceptionHelper.Convert(_session.Factory.SQLExceptionConverter, sqle, "could not get next sequence value", _owner._sql); } }
0
44. Example
View license[Test] public void TestParameter() { using (NuoDbConnection connection = new NuoDbConnection(connectionString)) { DbCommand command = connection.CreateCommand(); connection.Open(); command.CommandText = "select * from hockey where number = ?"; command.Prepare(); command.Parameters[0].Value = "2"; DbDataReader reader = command.ExecuteReader(); Assert.IsFalse(reader.Read()); reader.Close(); } }
0
45. Example
View license[Test] public void TestPrepareNoParameter() { using (NuoDbConnection connection = new NuoDbConnection(connectionString)) { DbCommand command = connection.CreateCommand(); connection.Open(); command.CommandText = "select * from hockey where number = 2"; command.Prepare(); DbDataReader reader = command.ExecuteReader(); Assert.IsFalse(reader.Read()); reader.Close(); } }
0
46. Example
View license[Test] public void TestBulkLoad_DataReaderNoMapping() { CreateTargetForBulkLoad(); NuoDbBulkLoader loader = new NuoDbBulkLoader(connectionString); loader.BatchSize = 2; loader.DestinationTableName = "TEMP"; using (NuoDbConnection connection = new NuoDbConnection(connectionString)) { DbCommand command = new NuoDbCommand("select position from hockey order by number", connection); connection.Open(); DbDataReader reader = command.ExecuteReader(); loader.WriteToServer(reader); reader.Close(); command = new NuoDbCommand("select count(*) from hockey", connection); object val = command.ExecuteScalar(); VerifyBulkLoad(Utils.ToInt(val), "Fan"); } }
0
47. Example
View licensepublic void ExecuteReader(string sql, Action<DbDataReader> action) { if (string.IsNullOrEmpty(sql)) throw new ArgumentNullException("sql", "A SQL query or stored procedure name is required"); Command.CommandText = sql; try { OpenConnection(); DbDataReader reader = null; try { reader = Command.ExecuteReader(); while (reader.Read()) { action(reader); } } finally { if (reader != null) reader.Close(); } } finally { CloseConnection(); } }
0
48. Example
View license[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2100:Review SQL queries for security vulnerabilities")] public void ExecuteReader(string commandText, Action<DbDataReader> action) { _logger.Trace(() => "Executing reader: " + commandText); SafeExecuteCommand( sqlCommand => { var sw = Stopwatch.StartNew(); try { sqlCommand.CommandText = commandText; var dataReader = sqlCommand.ExecuteReader(); while (!dataReader.IsClosed && dataReader.Read()) action(dataReader); dataReader.Close(); } finally { LogPerformanceIssue(sw, commandText); } }, _persistenceTransaction != null); }
0
49. Example
View licensepublic void ExecuteReader(string sql, Action<DbDataReader> action) { if (string.IsNullOrEmpty(sql)) throw new ArgumentNullException("sql", "A SQL query or stored procedure name is required"); Command.CommandText = sql; try { OpenConnection(); DbDataReader reader = null; try { reader = Command.ExecuteReader(); while (reader.Read()) { action(reader); } } finally { if (reader != null) reader.Close(); } } finally { CloseConnection(); } }
0
50. Example
View licensepublic override void CreateOrModify_TablesAndFields(string dataTable, DatasetConfig datasetConfig) /n ..... /n //View Source file for more details /n }