Service only works once useing
-
I have a service I wrote that uses a filewatcher. On create it takes the excel file and truncates table and import it. It works on my Windows 7 box. When I drag a new file into the folder it imports it. If i drag a newer file it deletes the old data and imports the new data. On Windows 2012 Server the service works on the first import. on the second drop of a excel file I get Error durring import of file 20151106.xls Exception occured in Microsoft JET Database Engine Exception: 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 shouldnt happen as I have
finally
{
if (oraConn.State == ConnectionState.Open)
{
oraConn.Close();
}
if (oleDbConn.State == ConnectionState.Open)
{
oleDbConn.Close(); //Close excel connection
}
oraConn.Dispose();
oleDbCmd.Dispose();
oleDbConn.Dispose();}
The service works fine on my windows 7 box and works for the first file on Windows 2012 server. Why is the service leaving the connection oleDbConn open on Windows Enterprise Server 2012? ?