Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Speed of fso

Status
Not open for further replies.

grimace

Technical User
Feb 14, 2001
7
GB
Hi,
I am having problems writing to and reading text files using fso. No errors are evident except that the page starts to load but goes so slowly that nothing ever appears and I've never waited more than 10 mins. The same has happened for other attempts to write/read files on other asp pages.
I've checked the folder permissions and they seem ok.


Function resultString(initialString)
strLinetr = Trim(initialString)
intHowLong = Len(strLinetr)
intword = intHowLong - 6
endStr = Right(strLinetr, intword)
End Function

Dim connS, connD
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const Create = False
Dim fso, ts,f, strLine, strFileName, counter
counter = 1

strFileName = Server.MapPath("results.txt")
set fso = server.CreateObject("Scripting.FileSystemObject")
set f = fso.GetFile(strFileName)
set ts = f.OpenAsTextStream(ForReading, -2)
If Not ts.AtEndOfStream Then
Do While Not ts.AtendOfStream
Select Case counter
Case 10
strLine = ts.ReadLine ' Read one line at a time
connS = resultString(strLine)
counter + 1
Case 11
strLine = ts.ReadLine ' Read one line at a time
connD = resultString(strLine)
counter + 1
Case Else
strLine = ts.ReadLine ' Read one line at a time
counter + 1
End Select
Loop
End If
ts.close

Hope someone can help as I am in desperate need of a solution
 
couple of things .. have you added any debugging error catching after each of the following lines:

set f = fso.GetFile(strFileName)
set ts = f.OpenAsTextStream(ForReading, -2)

to check they're OK?

Also, connS and connD will always be empty, as the resultString function doesn't return anything - which could be causing problems later in your code. codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
You're not a complete programmer unless you know how to guess.
I hope I never consider myself an 'expert'.
<insert witticism here>
 
I have this same issue, except it hangs indefinately when you attempt to access the fso.getFolder method. It is not a coding issue in my case. If you find yours not to be a code issue either and find a solution, please post it.
-Tarwn ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top