quote:Originally posted by stu9820
You must highlight all cells you are going to use and name it. In the example it is named 'Dell'
Sub Page_Load(Source As Object, E As EventArgs)
Dim strConnection As String = "Provider=Microsoft.Jet.OleDb.4.0;" & _
"data source=C:\BegASPNETdb\datastores\inventory.xls;" & _
"Extended Properties=Excel 8.0;"
Dim objConnection As New OleDbConnection(strConnection)
Dim strSQL As String = "SELECT * FROM Items WHERE Source='Dell'"
Dim objCommand As New OleDbCommand(strSQL, objConnection)
dgInventory.DataSource = objCommand.ExecuteReader()
Can you tell me how the Excel Sheet would be for the code you gave
This is what i used
The name of the file is Inventory.xls
Items is Cell A1 of the spreadsheet
I get the following error
The Microsoft Jet database engine could not find the object 'Items'. Make sure the object exists and that you spell its name and the path name correctly.