using System.Data;
using System.Data.OleDb;
class Program
{static void Main(string[] args)
{
//provider规定了用于这类数据库的OLEDB提供者名称
OleDbConnection thisConnection = new OleDbConnection(
@"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=E:\Nwind.mdb");
thisConnection.Open();
OleDbCommand thisCommand = thisConnection.CreateCommand();
thisCommand.CommandText = "Select CustomerID, CompanyName FROM Customers";
OleDbDataReader thisReader = thisCommand.ExecuteReader();
while (thisReader.Read())
{
Console.WriteLine("\t{0}\t{1}",
thisReader[0], thisReader[1]);
}
thisReader.Close();
thisConnection.Close();
}
}