Working with Result Sets

GFXDDataReader helps you work with multiple rows that are returned from a SQL statement.

The following example queries all rows from a sample table and stores the results in a GFXDDataReader object. The application then accesses and displays each row in the result set.
string gfxdHost = "localhost";
int gfxdPort = 1527;
string connectionStr = string.Format(@"server={0}:{1}", gfxdHost, gfxdPort);

GFXDClientConnection connection = null;

try
{
    connection = new GFXDClientConnection(connectionStr);

    GFXDCommand command = connection.CreateCommand();
    command.CommandType = CommandType.Text;
    command.CommandText = "SELECT * FROM product";
    
    connection.Open();

    GFXDDataReader reader = command.ExecuteReader();
    StringBuilder row = new StringBuilder();

    while (reader.Read())
    {
        for (int i = 0; i < reader.FieldCount; i++)
            row.AppendFormat("{0}, ", reader.GetString(i));

        Console.WriteLine(row.ToString());
    }
}
catch (Exception e)
{
    ///
    /// Log or re-throw exception
    /// 
}
finally
{
    connection.Close();
}