12. Understanding .NET Data Provider Connectivity : .NET Data Provider Classes : IngresDataReader Class : IngresDataReader Class Example
Share this page                  
IngresDataReader Class Example
The following is an example implementation of the IngresDataReader class:
static void ReaderDemo(string connstring)
    IngresConnection conn = new IngresConnection(connstring);
    string strNumber;
    string strName;
    string strSSN;
    IngresCommand cmd = new IngresCommand(
        "select number, name, ssn from personnel", conn);
    IngresDataReader reader = cmd.ExecuteReader();
    Console.Write(reader.GetName(0) + "\t");
    Console.Write(reader.GetName(1) + "\t");
    while (reader.Read())
        strNumber= reader.IsDBNull(0)?
        strName = reader.IsDBNull(1)?
        strSSN = reader.IsDBNull(2)?
        strNumber + "\t" + strName + "\t" + strSSN);