public Form3() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { srch(); } private void srch() { DataTable sheetData = new DataTable(); string strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source= 'c:\\Product Details.xlsx';Extended Properties='Excel 8.0;HDR=Yes;'"; string query = "select * from [Sheet1$]" ; DataSet excelDataSet = new DataSet(); OleDbDataAdapter da = new OleDbDataAdapter(query, strConn); da.Fill(excelDataSet); dataGridView1.DataSource = excelDataSet.Tables[0]; DataView dv = ((DataTable)dataGridView1.DataSource).DefaultView; DataView dv_filter = new DataView(); dv_filter.Table = excelDataSet.Tables[0]; dv_filter.RowFilter = "Product_ID = '" + textBox1.Text + "'"; dataGridView1.DataSource = dv_filter; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)