Click to See Complete Forum and Search --> : TXT reading help


linguist2000
08-28-2008, 08:28 AM
I am trying to read from a txt file, but something I dunno has error.
I am trying to write the data according to the today's date.

<%
Set DosyaNesnesi=CreateObject("Scripting.FileSystemObject")
Set Dosya=DosyaNesnesi.OpenTextFile(Server.MapPath("nob.txt"),1,False,False)
Do While Not Dosya.AtEndOfStream
okunandeger=Dosya.ReadLine
if Day(date) = Left(okunandeger, 2) Then
Response.Write (okunandeger)
Else
End If
Loop
Dosya.Close
Set Dosya=Nothing
Set DosyaNesnesi=Nothing
%>

nob.txt is like this:
04.08.2008
jack
school

05.08.2008
marry
here

06.08.2008
jane
home

07.08.2008
bill
center
.
.
.
.
27.08.2008
something
etc

28.08.2008
something
etc

29.08.2008
something
etc

Kuriyama
08-28-2008, 02:19 PM
1st problem. . .

okunandeger=Dosya.ReadLine

This will only display the last line I believe.

Bullschmidt
09-07-2008, 04:48 PM
I believe ReadLine usually reads the current line and don't know if this might hopefully help at all:

ASP TextStream Object
http://www.w3schools.com/asp/asp_ref_textstream.asp
"The TextStream object is used to access the contents of a text file."