using System;
using System.Data;
using System.Data.OleDb;
using System.Collections.Generic;
using System.Text;
class Program
{
static void Main(string[] args)
{
OleDbConnection thisConnection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:access.mdb");
thisConnection.Open();
OleDbCommand thisCommand = thisConnection.CreateCommand();
//Подключаемся к таблице Customers и выбираем столбцы CustomerID и CompanyName
thisCommand.CommandText = "SELECT CustomerID, CompanyName FROM Customers";
OleDbDataReader thisReader = thisCommand.ExecuteReader();
//Выводим выбранные столбцы на экран
while (thisReader.Read())
{
Console.WriteLine("t{0}t{1}",thisReader["CustomerID"], thisReader["CompanyName"]);
}
//Закрываем все подключения к базе
thisReader.Close();
thisConnection.Close();
}
}
0.00 (0%) 0 votes







