using System; using System.Data; using System.Data.SqlClient; class Program { static void Main(string[] args) { string sqlConnectString = "Data Source=(local);Integrated security=SSPI;Initial Catalog=AdventureWorks;"; string sqlSelect = "SELECT ContactID, FirstName, LastName FROM Person.Contact"; SqlDataAdapter da = new SqlDataAdapter(sqlSelect, sqlConnectString); DataTable dt = new DataTable( ); da.Fill(dt); for (int i = 0; i < 5; i++) { DataRow row = dt.Rows[i]; Console.WriteLine(i); Console.WriteLine(row[0]); Console.WriteLine(row["FirstName"]); Console.WriteLine(row[2, DataRowVersion.Default]); } } }