error running off IIS

G

gerryR

Hi All

I've a simple web app that pulls data from an excel sheet into a small aspx
page. When I browse the site through VS2005 everything works fine. When I
copy the project to IIS wwwroot folder I get a

ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found
and no default driver specified
[OdbcException (0x80131937): ERROR [IM002] [Microsoft][ODBC Driver Manager]
Data source name not found and no default driver specified]



Below is my connection string stored in web.config

<connectionStrings>
<add name="ConnectionString5" connectionString="DSN=Excel
Files;DBQ=C:\Inetpub\wwwroot\A2Z.xls;;DefaultDir=C:\Inetpub\wwwroot\;DriverId=1046;MaxBufferSize=2048;PageTimeout=5;"
providerName="System.Data.Odbc"/>
</connectionStrings>

Don't think its a permissions problem as for testing purposes I've given
"everyone" read write access to the wwwroot.

Really appreciate any help, am fairly new to this so apologies if its an
obvious solution. If you need any more info just ask.

Rgds
Gerry
 
J

Jeff Dillon

gerryR said:
Hi All

I've a simple web app that pulls data from an excel sheet into a small
aspx page. When I browse the site through VS2005 everything works fine.
When I copy the project to IIS wwwroot folder I get a

ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found
and no default driver specified
[OdbcException (0x80131937): ERROR [IM002] [Microsoft][ODBC Driver
Manager] Data source name not found and no default driver specified]



Below is my connection string stored in web.config

<connectionStrings>
<add name="ConnectionString5" connectionString="DSN=Excel
Files;DBQ=C:\Inetpub\wwwroot\A2Z.xls;;DefaultDir=C:\Inetpub\wwwroot\;DriverId=1046;MaxBufferSize=2048;PageTimeout=5;"
providerName="System.Data.Odbc"/>
</connectionStrings>

Don't think its a permissions problem as for testing purposes I've given
"everyone" read write access to the wwwroot.

Really appreciate any help, am fairly new to this so apologies if its an
obvious solution. If you need any more info just ask.

Debug your app to ensure that it is reading the config file correctly. Write
the connection string back to the client
 
G

gerryR

Hi and thanks for the help Mark

There was no reason for using ODBC other than I'm new to this and that's one
method I tried that worked (at least through VS)

I've tried the connection string below:

<add name="ConnectionString5" connectionString="OLEDB;
Provider='Microsoft.Jet.OLEDB.4.0;' Data
Source=C:\Inetpub\wwwroot\App_Data\A2Z.xls; Extended Properties=Excel
8.0;HDR=Yes;IMEX=1;" providerName="System.Data.OleDb" />

I'm now getting the error below:

Format of the initialization string does not conform to specification
starting at index 0

I'm searching for a solution but said I'd post it here in case the problem
was obvious to you?

Thanks for the info on the App_Data folder, I'll be sure to use that from
now on too.

Regards
Gerry


Mark Rae said:
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found
and no default driver specified
[OdbcException (0x80131937): ERROR [IM002] [Microsoft][ODBC Driver
Manager] Data source name not found and no default driver specified]

Firstly, is there a reason that you're trying to use ODBC instead of
OleDb? Assuming there isn't, change your connection string to the
following:

Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Inetpub\wwwroot\A2Z.xls;Extended Properties="Excel
8.0;HDR=Yes;IMEX=1";

or, if that doesn't work, try this:

OLEDB;Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Inetpub\wwwroot\A2Z.xls;Extended Properties="Excel
8.0;HDR=Yes;IMEX=1";

See here for further details:
http://www.connectionstrings.com/?carrier=excel

Also, you appear to have a double semi-colon in your connection string,
though I doubt that will make any difference.
Don't think its a permissions problem as for testing purposes I've given
"everyone" read write access to the wwwroot.

Not a good idea anyway. If you place the Excel workbook in your app's
App_Data folder and change the connection string accordingly, does it
work...?
http://www.velocityreviews.com/forums/t372614-what-is-the-appdata-folder-really-for.html
 
G

gerryR

Hi Mark,

Thanks for the quick reply and apologies for all the questions!

If I remove the single quotes I get an error saying there's no providor
specified

If I remove the OLEDB; I still get the format of the initialization string
error.

And I'm afraid I don't quiet follow regarding the App_Data question, I've
tried a few different paths but none seem to work (is that what you mean?)

Thanks
gerryR
 
G

gerryR

Hi Mark

Thanks for that, I had tried that all right but was getting the same error.

I've brought the project home and will have a go over the weekend using your
connection string.

Will post back Mon if I have any joy

Thanks again for all your help
gerryR
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top