using System; using System.Data; using System.Data.SqlClient; class MainClass { [STAThread] static void Main(string[] args) { string ConnectionString ="server=(local)\\SQLEXPRESS;database=MyDatabase;Integrated Security=SSPI;"; string SQL = "SELECT * FROM Employee"; SqlConnection conn = new SqlConnection(ConnectionString); SqlCommand cmd = new SqlCommand(SQL, conn); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); Console.WriteLine("ID, FirstName"); while (reader.Read()) { Console.Write(reader["ID"].ToString() + ", "); Console.Write(reader["FirstName"].ToString() + ", "); } reader.Close(); conn.Close(); } }