Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Service only works once useing

Service only works once useing

Scheduled Pinned Locked Moved C / C++ / MFC
databasesysadminhelpquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    derek 2008
    wrote on last edited by
    #1

    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? ?

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups