尝试按照 c# 代码获取数据库中的所有表名,但我收到一条错误消息:
“System.Data.OleDb.OleDbException (0x80040E14):无效的 SQL 语句;应为“DELETE”、“INSERT”、“PROCEDURE”、“SELECT”或“UPDATE”...”
OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + tbx_Source.Text + ";");
OleDbCommand cmd = new OleDbCommand("SHOW TABLES;", conn);
OleDbDataReader reader;
try
{
conn.Open();
reader = cmd.ExecuteReader();
if (reader.HasRows)
{
while (reader.Read())
{
cbx_Tables.Items.Add(reader.GetValue(0).ToString());
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
如何使用 OleDb 执行此类命令?
谢谢 :)