Introduction:
Here I will explain “The Microsoft Office 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.”
problem solution in asp.net
using C# and VB.NET.
Description:
In previous articles I explained Import/upload data from excel to gridview in asp.net, Export selected rows of gridview to excel/word document, Export gridview data to pdf in asp.net and many articles relating
to Excel, Gridview,
SQL ,jQuery,asp.net,
C#,
VB.NET.
Now I will explain how to solve the problem of “The Microsoft Office 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.”
in asp.net using C#
and VB.NET.
In one application I got requirement like Read or Import data from excel sheet to gridview and upload excel data to SQL database once implementation
completed I tested it in local everything working fine. After I deployed
application in server machine and tried to run then I got an error like "The
Microsoft Office 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”.
To solve this problem we need to grant the NETWORK
SERVICE account modify permission on my folder where our excel files will sit
for that follow below steps.
1.
Select your folder >> Right
click on folder and select properties like as shown below
2.
Once properties opened >> Select
Security Tab >> In that click on Edit button to change the
permissions like as shown below
3.
Once you click on Edit button another
window will open in that select Add button like as shown below
4.
Now click on Add button >>
Another window will open in that enter “Network Service” as name >>
click on Check Names like as shown below
5.
Once “Network Service” added set
permissions for Network Service and click ok like as show below
Once set network service permissions run your application i hope this will fix your
problem.
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
34 comments :
Hai sir,
i did same, but i am getting same error sir
sir,
i did same, but i am getting same error sir
SORRY SIR ITS STILL NOT WORKING
sorry sir but its not working
Hi Suresh,
I am getting this error , please help me
The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.
Hi All,
You will definitely get this error since the file is posted on file upload control it is used by it ... so it says 'opened exclusively'.The solution is that u first save the file on server then read it.
but how to set permission programmatically ?
HI,
I am trying to access MDB files placed on remote machines from a central server where SQL is running and it is giving me same error. What should i do?
SIR i'M GETTING SAME ERROR..
The Microsoft Office 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.
sir how to fix it ? its still error , i need your help . Thank you sir
Sir, still the same error.
The Microsoft Office 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.
For "network service" select and save modify right also and you all won't get any error further.
If you follow above process still getting the error, The problem is with the File Upload Control.
If we take path of the file to be uploaded as below
Fileupload1..PostedFile.FileName;
it is generating the error.
If we replace the Path manually(i.e. DataSource="c:\sample.xlsx" ) able to execute.
first u reply for these problems then will give a valuable feed back
Dear fri,
I am also getting same error. pl give me the solution. it urgent for me..i am waiting any one can reply fast.
protected void btnImport_Click(object sender, EventArgs e)
{
string path = Server.MapPath("~/App_Data/") + fileuploadExcel.FileName;
fileuploadExcel.SaveAs(path);
string a = fileuploadExcel.PostedFile.FileName;
OleDbConnection con_excel = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Extended Properties=Excel 8.0");
OleDbDataAdapter adpt = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", con_excel);
DataSet ds = new DataSet();
adpt.Fill(ds, "tbl_temp");
grvExcelData.DataSource = ds.Tables["tbl_temp"];
grvExcelData.DataBind();
}
After this code you need not to do anything else
Hi, with your above code the excel sheet is being displayed in my webpage in the gridview but is not getting inserted into my database. How do i get the data to my table in database?
My problem is with access not excel
Very helpful, my issue with access is solved by giving even modify rights to network service,
Thank u very much....
"The Microsoft Office 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."
Please suggest me a proper solution for this problem, I had tried a lot but didn't found solution for this error.
In my PC only .how to resolve it. other PC's it works fine.
hi my 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.
plz help me soon
please help me soon am waiting suresh ,sir
please
hope it will help you.
string path = Server.MapPath(UploadExcelFile.PostedFile.FileName);
Sorry sir it is not working..
Thnk u mr. santosh
System.Data.OleDb.OleDbException: Server connection error in my application. I am getting this error in Visual Studio 2012 c# asp.net aspx page. The Microsoft Office Access database engine could not find the object xls.
conString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + FullPath + ";Extended Properties=\"HTML Import\""; Thanks Mr. Suresh, your tutorials are quite good.
STILL it is not working sir....please provide the resolution
i have a problem with the postback, all works fine but dont show the grid with data says: "no file selected" but i put breakpoints and the grid has data nut sont show it in the postback.
Thanks for the help.
its not working :/
Hi sir i am getting this error
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.
so what is the solution to this error
Hi sir i am still getting this error
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.
please suggest me
on "Advance Security Settings" click Share tab. click add. click object type. include computer. click OK. Under 'Enter the object name to select' add the name of the computer your using to access the file. then click 'OK'. then apply.
Thank you. it works fine.
Note: Only a member of this blog may post a comment.