IDataReader dispoable

IDataReader dispoable

System.Data (system.data.dll) interface

The IDataReader interface is implemented by all data readers. A data reader provides a way to read a command-only stream of data from a data source. You can't create a data reader directly. Instead, an open IDataReader instance is returned from the IDbCommand.ExecuteReader( ) method. You can then use the Read( ) method to move from one row to the next . The Read( ) method returns true if it can successfully read a row or false if there are no more rows remaining, and it has moved beyond the bounds of the result set. There is no way to move backward. When it is first created, the IDataReader doesn't yet point to a row. You must call Read( ) to move to the first row before you attempt to read any information. You can use NextResult( ) to move to the next result set if you are using a command or stored procedure that returns multiple result sets.

You retrieve data from a row (the row the IDataReader is currently positioned on) by column name or index. The IDataReader acquires this functionality through the IDataRecord interface, which it extends.

 public interface  IDataReader  : IDisposable, IDataRecord {  // Public Instance Properties  public int  Depth  {get; }     public bool  IsClosed  {get; }     public int  RecordsAffected  {get; }  // Public Instance Methods  public void  Close  (  );      public DataTable  GetSchemaTable  (  );      public bool  NextResult  (  );      public bool  Read  (  );   } 

Implemented By

System.Data.OleDb.OleDbDataReader , System.Data.OracleClient.OracleDataReader , System.Data.SqlClient.SqlDataReader

Returned By

System.Data.Common.DbDataRecord.GetData( ) , IDataRecord.GetData( ) , IDbCommand.ExecuteReader( ) , System.Data.OracleClient.OracleDataReader.GetData( ) , System.Data.SqlClient.SqlDataReader.GetData( )

Passed To

System.Data.Common.DbDataAdapter.Fill( ) , System.Data.Common.DbEnumerator.DbEnumerator( )



ADO. NET in a Nutshell
ADO.NET in a Nutshell
ISBN: 0596003617
EAN: 2147483647
Year: 2005
Pages: 415

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net