Name

IDataRecord

Synopsis

This interface provides access to column values when you use a data reader. You can retrieve a value from a column using the indexer for IDataRecord with the column name or index. Alternatively, you can use one of the typed accessor methods to retrieve a column value by index and convert it to the specified type in one step. For example, GetInt32( ) retrieves the specified column value and casts it to the System.Int32 type. Provider-specific data readers add methods that return data using source-specific data types. You can use the FieldCount property to determine how many columns are in a table. However, if you aren’t positioned on a record (for example, you havn’t called IDataReader.Read( )), this property returns 0.

public interface IDataRecord {

// Public Instance Properties

   public int FieldCount{get; } 

   public object this[string 

                  name

                  ]{get; } 

   public object this[int 

                  i

                  ]{get; } 

// Public Instance Methods

   public bool GetBoolean(int i);  

   public byte GetByte(int i);  

   public long GetBytes(int i, long fieldOffset, byte[ ] buffer, int bufferoffset, int length);

   public char GetChar(int i);  

   public long GetChars(int i, long fieldoffset, char[ ] buffer, int bufferoffset, int length);

   public IDataReader GetData(int i);  

   public string GetDataTypeName(int i);  

   public DateTime GetDateTime(int i);  

   public decimal GetDecimal(int i);  

   public double GetDouble(int i);  

   public Type GetFieldType(int i);  

   public float GetFloat(int i);  

   public Guid GetGuid(int i);  

   public short GetInt16 ...

Get ADO.NET in a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.