using System.Data; IDbConnection connection = new SqlConnection(connectionString);
using System.Data; IDbCommand command = connection.CreateCommand(); command.CommandText = "SELECT * FROM Customers"; IDataReader reader = command.ExecuteReader(); while (reader.Read()) { // do something with the data } reader.Close();This example shows how to use the IDbCommand interface to execute a SELECT statement and retrieve the data using an IDataReader object. The command object is created from the connection object, and the command text is set to the SQL statement. The ExecuteReader method is used to execute the command and return a reader object. Package Library: System.Data.Common