Re: Error on creating a text file to write lines
From: Marina (someone_at_nospam.com)
Date: 01/06/05
- Next message: howard dierking: "API calls fail in ASP.Net"
- Previous message: Marina: "Re: can anyone answer this tuff question?"
- In reply to: JenHu: "Error on creating a text file to write lines"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 6 Jan 2005 16:05:53 -0500
Sounds like you opened this file at some point, but never closed it. So it
is still locked by the other object you used to access it. Make sure you
always close any stream that accesses your file.
You will probably need to restart asp.net to release the file lock.
"JenHu" <jenniferhu46@hotmail-dot-com.no-spam.invalid> wrote in message
news:41dda5eb$1_1@Usenet.com...
> Hi all,
>
> I want to create a text file to write lines, but it gives me an error
> on Dim sw As New StreamWriter(CreatePath & Efilename) :
> System.IO.IOException: The process cannot access the file
> "C:\temp\DD_01062005.txt" because it is being used by another
> process.
>
> Can someone point me out where did I do wrong? Thanks.
>
> ------------------------------------------------------------------
> Dim CreatePath As String = "C:\temp\"
> Dim Efilename As String = "DD_" & Format(Date.Today,
> "MMddyyyy").ToString & ".txt"
> File.Create(CreatePath & Efilename)
> Dim sw As New StreamWriter(CreatePath & Efilename)
>
> *-----------------------*
> Posted at:
> www.GroupSrv.com
> *-----------------------*
- Next message: howard dierking: "API calls fail in ASP.Net"
- Previous message: Marina: "Re: can anyone answer this tuff question?"
- In reply to: JenHu: "Error on creating a text file to write lines"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|