// Collection of code snippets by Arne Vajhøj // posted to eksperten.dk, usenet and other places (2002-now) using System; using System.Data.OleDb; public class MainClass { public static void Main(string[] args) { //OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Databases\MSAccess\Test.mdb"); OleDbConnection con = new OleDbConnection("Provider=SQLOLEDB;Data Source=ARNEPC3;Initial Catalog=Test;Integrated Security=SSPI;"); con.Open(); OleDbCommand cmd = new OleDbCommand("SELECT * FROM T1", con); OleDbDataReader rdr = cmd.ExecuteReader(); while(rdr.Read()) { int f1 = (int)rdr[0]; string f2 = (string)rdr[1]; Console.WriteLine(f1 + " " + f2); } con.Close(); } }