473,769 Members | 2,337 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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
Nov 19 '05 #1
3 3802
Connection pooling get in the way ? Try perhaps to disable connection
pooling in the query string to see if it helps...

Patrice

--

"guoqi zheng" <no@sorry.com > a écrit dans le message de
news:f5******** *************** *******@ureader .com...
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

Nov 19 '05 #2
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
Nov 19 '05 #3

"guoqi zheng" <no@sorry.com > wrote in message
news:f5******** *************** *******@ureader .com...
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.
Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
8330
by: Mountain Bikn' Guy | last post by:
I am having serious problems with the following IDE bug: Could not write to output file 'x.dll' -- 'The process cannot access the file because it is being used by another process. ' and BUG: "Could Not Copy Temporary Files to the Output Directory" Error Message When You Build a Solution That Contains Multiple Projects I have tried all the solutions in Microsoft Knowledge Base Article - 313512.
4
2397
by: news.microsoft.com | last post by:
I need some help here guys.... i have been simply trying to delete a file from the webserver using asp.net using the following code. System.IO.File.Delete(FullPath); however the error message i get is the following The process cannot access the file "e:\inetpub\wwwroot\client_dev\brands\Product_images\1450.jpg" because it is
1
8902
by: Tod Birdsall | last post by:
I am using Microsoft Office Document Imaging (MODI) with great success. However, when execute the following code, I get the error "The process cannot access the file 'myFile.tif'" (File name has been shortened). Here is the code I am using: -- BEGIN CODE -- public class OCRUtil : IDisposable { const string FILENAME = "myFile.tif"; private MODI.Document doc = null;
0
420
by: ary | last post by:
hi all I have a problem with working file when i upload a file in IIS I can'd Delete it. if I try to delete it in debug mode , it successfully worked. my error message "the process cannot access the file "path\filename.jpg" because it is being used by another process".
5
4715
by: bulldog8 | last post by:
I've read numerous posts and have tried multiple approaches that I found, but just cannot get a file renamed. I am using VB.Net 2002 ... Here is what I have tried: 1) Code common to all attempts: OldName = "c:\albums\061203\email\DSC07272.JPG" NewName = "c:\albums\061203\email\Lalala.JPG"
8
8863
by: =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= | last post by:
Hi; I copied a new set of files over to my ASP.NET dir (and subdirs) on our test server. This replaced every file for the app. When I first then tried to bring it up, I got the below error. After I bounced IIS, then it worked fine. log4net.dll is in the Bin directory. What is going on here - this makes no sense to me.
4
5594
by: gerardianlewis | last post by:
Any help appreciated. (VB.NET under XP and Vista, SP1 installed) My code, inherited from a VB6 version of an app that ran under W98, loads an image from a file into a PictureBox. The user may want to move or delete the file that is being shown. The corresponding event- driven code for "delete this picture" uses: My.Computer.FileSystem.DeleteFile(sPath)
2
15007
by: SCPOS | last post by:
Cannot delete X: It is being used by another person or program. Close any programs that might be using the file and try again. Of course I have tried closing any programs I know of that may be using the file (used X because the filename does not matter...it is a specific log file name to the application). I am logged onto a Windows Server 2003 computer that acts as a server for a LAN, but is physically joined to a domain. The local...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7408
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.