Tried following c# code to get all tablenames in the database, but I get an error-message saying:
"System.Data.OleDb.OleDbException (0x80040E14): Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or '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());
}
How do I execute this kind of commands with OleDb?
Thanks :)
Since you want to show all tables in database (i.e mdb) ,you can try
Worked for me