0

I have a small project in VS-2015 asp.net - c#, to read excel file data's. When I run it as localhost it's working fine. But after hosting to FTP, it's not working, giving error like

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

My Connection String - XLSX file  

String MyExcelFile = Server.MapPath(MyInput1.PostedFile.FileName); // Not Working
String MyExcelFile = System.IO.Path.GetFullPath(Server.MapPath(MyInput1.PostedFile.FileName)); // Not Working

String MyExcelFile = MyInput1.PostedFile.FileName; // Working good in localhost

But giving error after published to FTP.

String StrConn2 = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + MyExcelFile + "; Extended Properties=\"Excel 12.0; HDR=YES; \"";

String MyExcelSheet = "[Sheet1$]";
String  MySQLSelect = "select * from " + MyExcelSheet;
2
  • one thing i need to know, r u able to login remote login (RDP) to your ftp server ? Commented Aug 19, 2017 at 7:08
  • Yes, I can login , Thanks Commented Aug 19, 2017 at 10:04

1 Answer 1

2

this is because of Microsoft office(Excel) not installed on server. so you need to install microsoft office (Excel) or install Microsoft Access Database on server.

For download Microsoft Access Database go to : https://www.microsoft.com/en-US/download/details.aspx?id=13255

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.