I need to see if a table exists in an Access database used by my c# program. Is know there are SQL commands for other databases that will return a list of tables. Is there s
that one worked for me
using (OleDbConnection con = new OleDbConnection(connectionString))
{
con.Open();
DataTable dt = con.GetSchema("Tables");
var selectNames = dt.Rows.Cast().Where(c => !c["TABLE_NAME"].ToString().Contains("MSys")).ToArray();
foreach (var item in selectNames)
{
// add names to comboBox
comboBox1.Items.Add(item["TABLE_NAME"]);
}
}