|
-
Jul 14th, 2008, 06:59 PM
#1
Thread Starter
Member
[RESOLVED]ASP.net 2.0 appending to a text file
i am trying to append to a log file. i ca create the file and write but the next time it will overwrite the last everything in the file.
Dim sdate As DateTime = DateTime.Now.ToShortDateString()
Dim stime As DateTime = DateTime.Now.ToShortTimeString()
Dim TextFile As New StreamWriter("C:\jetpaytool" & Format(sdate, "yyyyMMdd") & ".log")
TextFile.WriteLine(Format(sdate, "yyyyMMdd") & " " & Format(stime, "HH:MM") & " " & "auth release " & GridView1.Rows.Count.ToString & " Rows " & TextBox1.Text & " " & TextBox2.Text & " " & TextBox3.Text)
TextFile.Close()
thanks in advance
Last edited by computerguy46; Jul 15th, 2008 at 06:54 PM.
Reason: resolved
-
Jul 15th, 2008, 01:07 PM
#2
Re: ASP.net 2.0 appending to a text file
Moving your thread to the ASP.NET forum from the ASP forum.
-
Jul 15th, 2008, 01:10 PM
#3
Re: ASP.net 2.0 appending to a text file
You can use System.IO.File.AppendText.
-
Jul 15th, 2008, 04:56 PM
#4
Thread Starter
Member
Re: ASP.net 2.0 appending to a text file
thanks mendhak for moving my post to the right fourm
but i can not import System.IO.File.AppendText. there must be a referance that i need to add but i have only been using asp.net for 8 days
-
Jul 15th, 2008, 06:52 PM
#5
Thread Starter
Member
Re: ASP.net 2.0 appending to a text file
found this link in another post
http://aspnet.4guysfromrolla.com/art...72303-1.2.aspx
changed code to this and it works fine
Dim sdate As DateTime = DateTime.Now.ToShortDateString()
Dim stime As DateTime = DateTime.Now.ToShortTimeString()
Dim objStreamWriter As StreamWriter
objStreamWriter = File.AppendText("C:\jetpaytool" & Format(sdate, "yyyyMMdd") & ".log")
objStreamWriter.WriteLine(Format(sdate, "yyyyMMdd") & " " & Format(stime, "HH:MM") & " " & "auth release " & GridView1.Rows.Count.ToString & " Rows " & TextBox1.Text & " " & TextBox2.Text & " " & TextBox3.Text)
objStreamWriter.Close()
thanks for all of your help
-
Jul 15th, 2008, 06:53 PM
#6
Thread Starter
Member
[RESOLVED]ASP.net 2.0 appending to a text file
trying to mark as resolved
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|