delete file failed, The process cannot access the file because it is being used by another process

Discussion in 'ASP .Net' started by guoqi zheng, Apr 13, 2005.

  1. guoqi zheng

    guoqi zheng Guest

    Dear sir,

    There is an import tool on my web application, user can upload Ms Access
    file, the file is saved at a temp folder on the server. After the import is
    finished, for security reason, I need to delete the imported Ms Access file,
    however, I always get above error, "The process cannot access the file
    because it is being used by another process"

    I did close the datareader and connection object. What else can I do to
    delete this file???????

    regards,

    Guoqi Zheng
    http://www.ureader.com
     
    guoqi zheng, Apr 13, 2005
    #1
    1. Advertising

  2. guoqi zheng

    Patrice Guest

    Connection pooling get in the way ? Try perhaps to disable connection
    pooling in the query string to see if it helps...

    Patrice

    --

    "guoqi zheng" <> a écrit dans le message de
    news:...
    > Dear sir,
    >
    > There is an import tool on my web application, user can upload Ms Access
    > file, the file is saved at a temp folder on the server. After the import

    is
    > finished, for security reason, I need to delete the imported Ms Access

    file,
    > however, I always get above error, "The process cannot access the file
    > because it is being used by another process"
    >
    > I did close the datareader and connection object. What else can I do to
    > delete this file???????
    >
    > regards,
    >
    > Guoqi Zheng
    > http://www.ureader.com
     
    Patrice, Apr 13, 2005
    #2
    1. Advertising

  3. guoqi zheng

    guoqi zheng Guest

    How can I disable connection pooling?

    I add pooling=false in the connection string, then I got "Could not find
    installable ISAM." error


    regards,

    Guoqi Zheng
    http://www.ureader.com
     
    guoqi zheng, Apr 13, 2005
    #3
  4. guoqi zheng

    vMike Guest

    "guoqi zheng" <> wrote in message
    news:...
    > Dear sir,
    >
    > There is an import tool on my web application, user can upload Ms Access
    > file, the file is saved at a temp folder on the server. After the import

    is
    > finished, for security reason, I need to delete the imported Ms Access

    file,
    > however, I always get above error, "The process cannot access the file
    > because it is being used by another process"
    >
    > I did close the datareader and connection object. What else can I do to
    > delete this file???????
    >
    > regards,
    >
    > Guoqi Zheng
    > http://www.ureader.com


    Make sure you also close the stream that holds the imported file once you
    have written it out. (assuming that is how your are writing to the temp
    folder). If you open the temp file to copy it or move it, make sure you are
    closing that too. File operations are not managed by .net in many cases.
     
    vMike, Apr 13, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page