IBM® Informix® Client Software Development Kit, Version 4.10

Retrieve multiple rows

You can use an IfxDataReader object for simple access to data when you do not have to write and do not have to move backward.

The following example connects to the stores_demo database and uses an IfxDataReader object to retrieve all of the first names from the customer table. For more information about the IfxDataReader class, see IfxDataReader class.

    // Open a connection
    IfxConnection conn = 
        new IfxConnection(
        + "User ID=mylogin;password=mypassword"

// Create an SQL command
IfxCommand cmd = new IfxCommand(
              "SELECT fname FROM customer", 
              conn );
IfxDataReader dr = cmd.ExecuteReader();
// Write the data to the console
while (dr.Read())
Console.ReadLine(); // Wait for a Return

// Close the connection
catch(IfxException e) 
    Console.ReadLine(); // Wait for a Return

Examples exchange | Troubleshooting

To find the PDF, see Publications for the IBM Informix 12.10 family of products.
For the release notes, documentation notes, and/or machine notes, see the Release Notes page.