c# - Fill and Refresh Datagridview upon button click -


i upon button click retrieve , place data onto datagridview. however, after change "location", location , execute button click receive error. below code have , error 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 mtable 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 input table or query 'mastertable'.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -