Microsoft JET database error while trying to open excel file from ASP.NET

R

rh.krish

Hi
I'm trying to open an excel file uploaded by the user and read the
content. I'm able to save the file in the web server, but when I try to
open it - I get the following error:

"The Microsoft Jet database engine cannot open the file ''. It is
already opened exclusively by another user, or you need permission to
view its data.
"

This is the code i used to get the data:
fileName = "Shippers.xls";
string excelConStr = "Provider=Microsoft.Jet.OLEDB.4.0;Extended
Properties='Excel 8.0;HDR=Yes';Data Source=" + fileName;
OleDbConnection con = new OleDbConnection ( excelConStr );
con.Open ();
......
......
......

I had granted write access to the folder (where i save the file) and
the MACHINE\ASPNET account - but no use.
Help please!....

Regards,
Hari.
 
K

Kevin Spencer

Did you close the file after writing it to the disk?

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.
 
P

Paul Clement

On 29 Dec 2005 15:57:31 -0800, (e-mail address removed) wrote:

¤ Hi
¤ I'm trying to open an excel file uploaded by the user and read the
¤ content. I'm able to save the file in the web server, but when I try to
¤ open it - I get the following error:
¤
¤ "The Microsoft Jet database engine cannot open the file ''. It is
¤ already opened exclusively by another user, or you need permission to
¤ view its data.
¤ "
¤
¤ This is the code i used to get the data:
¤ fileName = "Shippers.xls";
¤ string excelConStr = "Provider=Microsoft.Jet.OLEDB.4.0;Extended
¤ Properties='Excel 8.0;HDR=Yes';Data Source=" + fileName;
¤ OleDbConnection con = new OleDbConnection ( excelConStr );
¤ con.Open ();
¤ .....
¤ .....
¤ .....
¤
¤ I had granted write access to the folder (where i save the file) and
¤ the MACHINE\ASPNET account - but no use.
¤ Help please!....

Try providing "full" access to the folder where this file is located.


Paul
~~~~
Microsoft MVP (Visual Basic)
 

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

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,052
Latest member
LucyCarper

Latest Threads

Top