Solved

How to append text to a file in asp without overwriting it?

Posted on 1998-03-26
2
159 Views
Last Modified: 2013-12-25
I want to append text to a file within asp. I am trying to open the textfile for appending but I can't. I can only open it for writing which obviously rewrites the whole file erasing its previous contents. I have tried the "ForAppending" parameter (value 3) but it doesn't work.

Any ideas on the subject? Any reasons why it doesn't work?
Any workaround you know?


I'd really appreciate your help.



Thank you very much.
0
Comment
Question by:manuelf
2 Comments
 

Accepted Solution

by:
juliomb earned 20 total points
ID: 1832217
Your problem it's the mode of openfile, "ForAppending it's value '8' not '3'

Please, test this code.

-----------------------------------

' Create Object
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")

' Open Scream por Append

  Set OutStream= FileObject.OpenTextFile ("file_name", 8)

  OutputString = "your text to append"

  OutStream.WriteLine OutputString

'Clear
  Set OutStream = Nothing
-----------------------------------
0
 

Author Comment

by:manuelf
ID: 1832218
This morning I had already found the right value (8) but thanks a lot anyway julio.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now