readline - opposite?

Posted on 2005-04-25
Last Modified: 2008-03-06

I'm using

strText = objOpenFile.Readline

to read a line from a text file. Is there a command to delete that line from the file once I've done with it?


Question by:abenbow
    LVL 6

    Accepted Solution

    LVL 9

    Expert Comment

    AFAIK there ar only three ways to open a file using the filesystemobject - Read, Write and Append.  There is no random R/W access.  Even if there were, there is no easy way to just delete a portion of a file without loading it into a temp space and re-writing it.  You might want to consider placing the info in question in a small DB such as Access instead of a flat text file, if possible.  You could then add and delete records at will.
    LVL 9

    Expert Comment

    Well, then, there IS that!
    LVL 6

    Expert Comment

    in, they wrote :
    "The way the File System Object works, there's no easy way to edit text, delete a line, or even insert a line in the middle of a file. To do anything like that you usually need to read the contents of the file, edit the string that you read and write it back out. There's no reason you can't write it back out to the same filename which would basically achieve the desired result.

    However, there is a downside. On a busy site (or even if you're just unlucky) there is the chance that someone else could be editing the same file at the same time you are. With the right timing, this could result in the loss of some or all of the data contained in the file".

    I would also suggest what danataylor has said before, if it's pussible, if not you can still use the function in the address I sent you above.

    Author Comment


    ok, I am putting it all into a database, the first line is the fieldnames and I'm using it to create a new table. I was having a problem inserting the data into the table but solved that with BULK INSERT. Unfortunately BULK INSERT also adds the first row. I was hoping that deleting the first row would be easy and there by save me trying to work out how to delete it from the database when I don't know the field names or the contents of the table

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Classic ASP + JS 4 58
    add custom headers to my mail 2 32
    Dreamweaver server behavior gone 6 50
    Age between date range query (SP) 13 38
    I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
    Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    This video discusses moving either the default database or any database to a new volume.

    730 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

    18 Experts available now in Live!

    Get 1:1 Help Now