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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.