[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

readline - opposite?

Posted on 2005-04-25
5
Medium Priority
?
239 Views
Last Modified: 2008-03-06
Hi

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?

thx

Andy
0
Comment
Question by:abenbow
  • 2
  • 2
5 Comments
 
LVL 6

Accepted Solution

by:
Dirar Abu Kteish earned 1000 total points
ID: 13859391
0
 
LVL 9

Expert Comment

by:danataylor
ID: 13859417
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.
0
 
LVL 9

Expert Comment

by:danataylor
ID: 13859449
Well, then, there IS that!
0
 
LVL 6

Expert Comment

by:Dirar Abu Kteish
ID: 13859473
in asp101.com, 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.
0
 

Author Comment

by:abenbow
ID: 13859671
lol

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
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

829 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