Код. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;
using System.Data.OleDb;
namespace Подключение_к_БД_Access__1_ { public partial class Form1 : Form { OleDbConnection conn; OleDbDataAdapter adapter;
DataTable dt = new DataTable();
public Form1() { InitializeComponent(); }
private void Form1_Load(object sender, EventArgs e) { conn = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;" + "Data Source=db1.mdb");
adapter = new OleDbDataAdapter("SELECT * FROM [Таблица 1]", conn);
adapter.Fill(dt);
dataGridView1.DataSource = dt; } } }
|