Microsoft Jet database engine cannot open the file It is already opened exclusively by another user

Last Reply on Jan 30, 2013 11:01 PM By Narendra

Posted on Jan 30, 2013 08:02 AM

Hello sir in one of my application m reading xls file which i wnt cantinuesly using

( string constr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + file + ";Extended Properties=Excel 8.0;";)  ......but it give m error as ...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............. n i wnt ds file open as it cantinuesly chnges done in it so how can i give th epermission to file which can i access with its open status.....Thnx in advance

Posted on Jan 30, 2013 11:01 PM

first check with file whether it open or not

if it open close it and build the application eve though your facing the same  try with the following code

These kind of issues may occur when "SNo"column may contains the  alpha-numeric values.. try with the below code where convertion happen's

connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+ fileLocation + @";Extended Properties="+ Convert.ToChar(34).ToString() + @"Excel 8.0;Imex=1;HDR=Yes;"+ Convert.ToChar(34).ToString();