0

Below i write the coding which is not working properly yo me.I want to open excel file and use select statement with where clause.But one I run the coding it give me exception it says
"No Value give for one or more parameters"
Pls help me.

Excel.Workbook theWorkbook = ExcelObj.Workbooks.Open("C:\\Shop Transfer1.xls", 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "", true, false, 0, false, true, false);

            // get the collection of sheets in the workbook
            Excel.Sheets sheets = theWorkbook.Worksheets;
            // get the first and only worksheet from the collection of worksheets
            MessageBox.Show(sheets.Count.ToString());
            Excel.Worksheet worksheet = (Excel.Worksheet)sheets.get_Item(1);
            string str1 = "Select * from [Sheet1$] where ShopCode='"+00016658+"'";           
                    

            OleDbCommand command1 = new OleDbCommand(str1, olecon);
            DataSet da = new DataSet();
            OleDbDataAdapter adapter = new OleDbDataAdapter(command1);
            adapter.Fill(da);
             dataGridView1.DataSource = da.Tables[0];

Thanks

3
Contributors
2
Replies
4
Views
9 Years
Discussion Span
Last Post by dickersonka
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.