Object Not Found

J

JimHeavey

I am trying to read an excel file using .Net OLEDB connection. I am able to
open the file, but once I attempt to retrieve a datareader I get an "object
not found" error message. The specific message is as follows "The Microsoft
Jet database engine could not find the object 'RuleDescriptions'. Make sure
the object exists and that you spell its name and the path name correctly."

"RuleDescriptions" is the name of the sheet which contains the information,
in fact it is the only sheet in the excel file. I have tried changing the
name of the sheet, hoping that perhaps that there might be something wrong
how I keyed in the name of the sheet. I have copied the sheet name directly
into the code, but it always gives the same error message.

The SQL statement looks like the following: "Select * From
[RuleDescriptions]"

My connection string looks like the following:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\temp\COMBO EDIT
DESCRIPTIONS.xls;Extended Properties="Excel 8.0;HDR=YES;IMEX=1"

Any ideas as to what I am doing wrong?
 
J

JimHeavey

Apparently you need a "$" to follow the sheet name and this is why the object
was not found.
 
S

sloan

Yeah you need that.
And be VERY CAREFUL (and anal) which editing the connection string.

You might need single quotes around the filename...when there is a space in
the path..I'm not sure.



JimHeavey said:
Apparently you need a "$" to follow the sheet name and this is why the
object
was not found.

JimHeavey said:
I am trying to read an excel file using .Net OLEDB connection. I am able
to
open the file, but once I attempt to retrieve a datareader I get an
"object
not found" error message. The specific message is as follows "The
Microsoft
Jet database engine could not find the object 'RuleDescriptions'. Make
sure
the object exists and that you spell its name and the path name
correctly."

"RuleDescriptions" is the name of the sheet which contains the
information,
in fact it is the only sheet in the excel file. I have tried changing
the
name of the sheet, hoping that perhaps that there might be something
wrong
how I keyed in the name of the sheet. I have copied the sheet name
directly
into the code, but it always gives the same error message.

The SQL statement looks like the following: "Select * From
[RuleDescriptions]"

My connection string looks like the following:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\temp\COMBO EDIT
DESCRIPTIONS.xls;Extended Properties="Excel 8.0;HDR=YES;IMEX=1"

Any ideas as to what I am doing wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top