string connectionString = "In the above example, we create a SqlConnection object and open the connection. Then, we create a SqlCommand object using the CreateCommand() method and set its CommandText property to a simple SELECT statement. Finally, we execute the query using the ExecuteReader() method and iterate over the results using a SqlDataReader object. The System.Data.SqlClient namespace is the package library used for this example."; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); SqlCommand sqlCommand = connection.CreateCommand(); sqlCommand.CommandText = "SELECT * FROM Customers"; using (SqlDataReader reader = sqlCommand.ExecuteReader()) { while (reader.Read()) { Console.WriteLine("{0}, {1}", reader.GetString(0), reader.GetString(1)); } } }