Show Data Inputted in Textbox to dataGridView using Excel (oledb) and C# -


i need help. want show data based on number input in textbox. number inputted in textbox threshold. want show data in table "reject" more threshold datagridview. can me ? code :

if (nominalbox.text != "") {     int thresholdcas50;     int32.tryparse(nominalbox.text, out thresholdcas50);       koneksi.open();     system.data.datatable aksesdatatabel;     aksesdatatabel = koneksi.getoledbschematable(oledbschemaguid.tables, null);     koneksi.close();      oledbcommand command = new oledbcommand     (         "select reject [sheet1$]", koneksi     );      dataset coba = new dataset();     oledbdataadapter adapter = new oledbdataadapter(command);     adapter.fill(coba);      // here want read datas in "reject" , convert     // them integer. there error here.     // says "input string not in correct format".     int x = int.parse(coba.tables[0].tostring());      if (x > thresholdcas50)     {         // stuck here. don't know how show datas         // more threshold.         datagridview1.datasource = coba.tables[0];     } } 

can me ? confused how can show data more threshold. thank you

try this:

if (nominalbox.text != "") {     int thresholdcas50;     int32.tryparse(nominalbox.text, out thresholdcas50);      koneksi.open();     system.data.datatable aksesdatatabel;     aksesdatatabel = koneksi.getoledbschematable(oledbschemaguid.tables, null);     koneksi.close();       oledbcommand command = new oledbcommand     (         "select reject [sheet1$]", koneksi     );      dataset coba = new dataset();     oledbdataadapter adapter = new oledbdataadapter(command);     adapter.fill(coba);      // made variable quick identify table.     var table = coba.tables[0];      // make view table.     var view = new dataview(table);      // make filter on view.     view.rowfilter = string.format("reject > {0}", thresholdcas50);      // set datasource filter.     datagridview1.datasource = view; } 

Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -