using System.Data.SqlClient; string connectionString = "Data Source=myServerAddress;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword"; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); string sql = "SELECT * FROM Customers"; using (SqlCommand command = new SqlCommand(sql, connection)) { using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { Console.WriteLine(reader["CustomerID"].ToString() + " " + reader["CompanyName"].ToString()); } } } }This code retrieves all rows and columns from the Customers table in the database and prints out the CustomerID and CompanyName of each row. Package library: System.Data.SqlClient is part of the .NET Framework Class Library.