我有访问数据库文件,其中包含 7 个表,但我不知道如何连接和显示所有表,如果有人可以帮助我?
这是我的代码,但没有显示任何内容
private void button1_Click(object sender, EventArgs e)
{
OleDbConnection conn = new OleDbConnection();
String connection = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\\Tables.accdb;Persist Security Info=True";
string sql = "SELECT Clients FROM Tables";
conn.ConnectionString = connection;
conn.Open();
DataSet ds = new DataSet();
DataGridView dataGridView1 = new DataGridView();
BindingSource bSource = new BindingSource();
OleDbDataAdapter adapter = new OleDbDataAdapter(sql,conn);
adapter.Fill(ds);
//conn.Close();
dataGridView1.DataSource = ds;