using System;
using System.Data.OleDb;
class Program
{
static void Main(string[] args)
{
string oledbConnectString = "Provider=SQLOLEDB;Data Source=(local);" +
"Initial Catalog=AdventureWorks;Integrated Security=SSPI";
string sqlSelect = "SELECT TOP 5 Title, FirstName, LastName FROM Person.Contact";
using (OleDbConnection connection =new OleDbConnection(oledbConnectString))
{
OleDbCommand command = new OleDbCommand(sqlSelect, connection);
connection.Open( );
OleDbDataReader reader = command.ExecuteReader( );
while (reader.Read( ))
Console.WriteLine("{0} {1}", reader[0], reader[1]);
}
}
}