Re: Guestbook with slight scripting problem
From: Viatcheslav V. Vassiliev (msnewsgroup_at_www-sharp.com)
Date: 06/29/04
- Next message: ym: "Input past end of file ???"
- Previous message: Bill White: "Re: Guestbook with slight scripting problem"
- In reply to: Bill White: "Re: Guestbook with slight scripting problem"
- Next in thread: Steven Burn: "Re: Guestbook with slight scripting problem"
- Reply: Steven Burn: "Re: Guestbook with slight scripting problem"
- Reply: Bill White: "Re: Guestbook with slight scripting problem"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 29 Jun 2004 15:28:39 +0400
You could check end of stream every time before reading next line:
gbname = gbfile.readline
if gbfile.AtEndOfStream then exit do
gbtime = gbfile.readline 'This is line 32 - see error msg above
if gbfile.AtEndOfStream then exit do
gbentry = gbfile.readline
This way you will skip last one or two lines.
Or may be you could store all data in one line, for example, tab-separated,
read one line and use Split function.
//------------------------------------
Regards,
Vassiliev V. V.
http://www-sharp.com -
Scripting/HTA/.Net Framework IDE
"Bill White" <news@helpplease.com> сообщил/сообщила в новостях следующее:
news:JrbEc.7195$mN3.7006@lakeread06...
> Yes, Vassiliev, you're right. When a user hits the Enter key, to create a
> new line, it essentially turns my 3 lines into 4. But, what I don't know
is
> what code I can use to remove that Enter character when I'm reading the
text
> file. Can you help with that? Thanks so much for the quick response!
>
>
>
> "Viatcheslav V. Vassiliev" <msnewsgroup@www-sharp.com> wrote in message
> news:ukwJsGcXEHA.3716@TK2MSFTNGP11.phx.gbl...
> > You read 3 lines at a time:
> >
> > > gbname = gbfile.readline
> > > gbtime = gbfile.readline 'This is line 32 - see error msg above
> > > gbentry = gbfile.readline
> >
> > It seems that gblist.txt lines count is not multiple of 3. For example,
> this
> > will happen if your .txt file has 4 lines.
> >
> > //------------------------------------
> > Regards,
> > Vassiliev V. V.
> > http://www-sharp.com -
> > Scripting/HTA/.Net Framework IDE
> >
> > "Bill White" <news@helpplease.com> сообщил/сообщила в новостях
следующее:
> > news:JqaEc.7177$mN3.1922@lakeread06...
> > > I've created a guest book that works fine as long as the user doesn't
> use
> > > the Enter Key to do a hard return while typing. The error I get is:
> > >
> > > ----------------------------------------------------
> > > Error Type:
> > > Microsoft VBScript runtime (0x800A003E)
> > > Input past end of file
> > > /guestbook/gblist.asp, line 32
> > > -----------------------------------------------------
> > >
> > > I would appreciate it if someone can tell how to fix this. Here's the
> > code.
> > > Thanks!
> > >
> > >
> > > <%
> > > dim filesys, gbfile, gbname, gbentry, gbtime
> > > set filesys = createobject("Scripting.FileSystemObject")
> > > set gbfile = filesys.OpenTextFile("C:\web\GuestBook\gblist.txt",1)
> > > Do While Not gbfile.AtEndOfStream
> > > gbname = gbfile.readline
> > > gbtime = gbfile.readline 'This is line 32 - see error msg above
> > > gbentry = gbfile.readline
> > > response.write gbname
> > > %>
> > > entered this comment on:
> > > <%
> > > response.write gbtime & "<br>"
> > > response.write gbentry & "<br>"
> > > %>
> > > <hr>
> > > <%
> > > loop
> > > gbfile.close
> > > Set filesys = nothing
> > > %>
> > >
> > >
> > > In case you want to know how the text file was written to, here's that
> > code
> > > from the previous ASP page:
> > >
> > > <%=request.form("Name")%><br>
> > > <br>
> > > <%=request.form("Guest_Book_Entry")%>
> > > <%
> > > dim filesys, gbfile
> > > set filesys = CreateObject("Scripting.FileSystemObject")
> > > set gbfile =
filesys.OpenTextFile("C:\web\GuestBook\gblist.txt",8,true)
> > > gbfile.writeline request.form("Name")
> > > gbfile.writeline (Date)
> > > gbfile.writeline request.form("Guest_Book_Entry")
> > > gbfile.close
> > > Set filesys = nothing
> > > %>
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
>
>
- Next message: ym: "Input past end of file ???"
- Previous message: Bill White: "Re: Guestbook with slight scripting problem"
- In reply to: Bill White: "Re: Guestbook with slight scripting problem"
- Next in thread: Steven Burn: "Re: Guestbook with slight scripting problem"
- Reply: Steven Burn: "Re: Guestbook with slight scripting problem"
- Reply: Bill White: "Re: Guestbook with slight scripting problem"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|