| | |
Excel and C#
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
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.
Thanks
"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
Last edited by Tank50; Sep 10th, 2008 at 6:05 am.
•
•
Join Date: Aug 2008
Posts: 1,162
Reputation:
Solved Threads: 137
might try [ShopCode] if your error is in that line
also use columns instead of star
also use columns instead of star
Custom Application & Software Development
www.houseshark.net
www.houseshark.net
![]() |
Similar Threads
- Excel to Web in Real Time? (ASP)
- How to write files to an Excel application (Visual Basic 4 / 5 / 6)
- grabbing source from excel file (was: please, somebody help me!!!) (Visual Basic 4 / 5 / 6)
- Macros in Excel (Visual Basic 4 / 5 / 6)
- Visual C++ and Excel (C++)
Other Threads in the C# Forum
- Previous Thread: Beginner Q - UI update, different thread, different class.
- Next Thread: Read keyboard in console application: a special case !
| Thread Tools | Search this Thread |
.net access activedirectory ado.net algorithm array barchart bitmap box broadcast buttons c# check checkbox client color combobox connect control conversion csharp custom database datagrid datagridview dataset datetime degrees development disabled displayingopenforms draganddrop drawing encryption enum event excel file foreach form format forms ftp function gdi+ httpwebrequest image index index-error input install java label list listbox listener mandelbrot math mathematics mouseclick mysql operator path photoshop picturebox pixelinversion post prime programming radians regex remote remoting richtextbox serialization server setup sleep socket sql statistics stream string table tcp text textbox thread time timer update user usercontrol validation visualstudio webbrowser windows winforms wpf xml






