I upon button click i retrieve and place data onto a datagridview. However, after i change the "Location", the location and execute button click i receive an error. Below is the code i have and the error i receive.
Code:
private void button1_Click(object sender, EventArgs e)
{ UpdateDG(); }
private void UpdateDG()
{
Con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=F:\\DbFile\\MasterData.accdb");
Con.Open();
DataTable dt = new DataTable();
OleDbDataAdapter da = new OleDbDataAdapter();
da = new OleDbDataAdapter("Select Inc1, Inc2 from MTable where Loc='" + Location+ "'", Con);
da.Fill(dt);
Dg.DataSource = dt;
Dg.Columns[0].HeaderText = "IncTest1";
Dg.Columns[1].HeaderText = "IncTest2";
Con.Close();
Error:
The Microsoft Access database engine cannot find the input table or query 'MasterTable'.