Incorrect OLE DB Error?
I am using ASP to open an excel document.
I should rephrase that... I am trying to open an excel document using ASP. Just to ensure the connection is working I am trying to connect to it as I would an access database and then loop through the records displaying each. It is not working at all.
I have got to the point where I am getting the following error:
<?php
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Excel Driver] The Microsoft Jet database engine cannot open the file 'list'. It is already opened exclusively by another user, or you need permission to view its data.
/DataMerge.asp, line 6
?>
This error is not correct because the file was sent as an attachment of an email and I just right clicked and saved the file. Noone has ever opened this file.
Here is the code I've found throughout the internet to connect to this excel document.
<?php
ConnectString = \"Provider=MSDASQL.1;\" & _
\"Persist Security Info=False;\" & _
\"Extended Properties=\"\"DBQ=\" & _
server.MapPath(\"selfinstall_list.xls\") & _
\";Driver={Microsoft Excel Driver \" & _
\"(*.xls)};\" & _
\"DriverId=790;FIL=excel 8.0;\" & _
\"MaxBufferSize=2048;\" & _
\"MaxScanRows=8;\" & _
\"PageTimeout=5;ReadOnly=1;\" & _
\"SafeTransactions=0;Threads=3;\" & _
\"UID=admin;UserCommitSync=\" & _
\"Yes;\"\";\" & _
\"User Id=admin;\"
strSQL = \"SELECT RTN\" & _
\" FROM list.xls\"
Set objRecord = cnn.Execute(strSQL)
MyArray = objRecord.GetRows
Set objRecord = Nothing
cnn.Close
Set cnn = Nothing
For x = 0 To UBound(MyArray,2)
Response.Write(MyArray(0,x) & \"<br>\")
Next
?>
Thanks for any help.
Wil posted this at 10:15 — 2nd April 2002.
They have: 601 posts
Joined: Nov 2001
Does the following information help?
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q190006
Peter J. Boettcher posted this at 13:41 — 2nd April 2002.
They have: 812 posts
Joined: Feb 2000
What are the permissions on the file (file system)? Make sure the IUSR_machinename account has enough access to wherever that Excel file is.
Is the file password protected?
PJ | Are we there yet?
pjboettcher.com
artsapimp posted this at 15:30 — 2nd April 2002.
They have: 330 posts
Joined: Apr 2000
I'm kind of embarrassed to write this but we have given full access to everyone while testing this and it still didn't fix the problem. I have tried everything that I can find.
Yes, I also tried the microsoft support which did not resolve my problem. When searching microsoft for that error you get a large number of resolutions. I tried every one I could find.
My resolution to this point is to create a link to the excel document within access and reference it with the same connectstring as the rest of the data. It seems to be easier on the server anyway.
Does anyone know of a better way or a problem I might find down the road by using this method?
Free Math Test
Fun Math Games
Wil posted this at 15:40 — 2nd April 2002.
They have: 601 posts
Joined: Nov 2001
Don't you just love Microsoft?
http://www.google.com/search?q=ODBC+Drivers+error+80004005
Results 1 - 10 of about 27,300. Search took 0.14 seconds.
- wil
detox posted this at 14:10 — 4th April 2002.
They have: 571 posts
Joined: Feb 2001
only 27,300 ????
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.