I need your help. I want to show all data based on number I input in textbox. Number that is inputted in textbox will be my threshold. I want to show all data in table "Reject" that more than my threshold to datagridview. Can anyone help me ? This is my 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 from [Sheet1$]", koneksi
);
DataSet coba = new DataSet();
OleDbDataAdapter adapter = new OleDbDataAdapter(command);
adapter.Fill(coba);
// Here I want to read all datas in "Reject" and convert
// them into integer. There is an error here.
// It says "Input string was not in a correct format".
int x = int.Parse(coba.Tables[0].ToString());
if (x > thresholdcas50)
{
// I stuck here. I don't know how to show all datas that
// more than my threshold.
dataGridView1.DataSource = coba.Tables[0];
}
}
Can anyone help me ? I confused how I can show only data that more than my threshold. Thank you