Still not working...

Results 1 to 2 of 2

Thread: Still not working...

  1. #1
    Join Date
    Dec 1969

    Default Still not working...

    &#060;%<BR> Dim strdate, strcontents, bolfound, strdatenumber<BR> Const Forreading = 1<BR> Dim objOpenFile, objFSO, strPath<BR> strPath = Server.MapPath("events.txt")<BR> Set objFSO = _<BR> Server.CreateObject("Scripting.FileSystemObject")< BR> strdatenumber = 1<BR> Set objOpenFile = _<BR> objFSO.OpenTextFile(strPath, forreading)<BR> strdate = objopenfile.readline<BR> strdate = dateadd("d",strdatenumber,strdate)<BR> do while not bolfound = true <BR> strcontents = objopenfile.readline &#060;&#060;ERROR HERE&#062;&#062;<BR> if Instr(1,strcontents,strdate,1) then <BR> bolfound = true<BR> end if<BR> loop<BR> if bolfound = true then<BR> Response.Write("&#060;B&#062;" & "strcontents" & "&#060;/b&#062;&#060;P&#062;")<BR> do while strcontents is not ""<BR> strcontents = objopenfile.readline<BR> Response.Write strcontents & "<BR>" & vbNewLine<BR> loop<BR> end if<BR> objOpenFile.Close<BR> Set objOpenFile = Nothing<BR> Set objFSO = Nothing<BR>%&#062;<BR><BR>I have pointed out where in the code the error is, it returns a server.createobject failed error, I am trying to read through a text file using the date found out at the top of the page and then, once that date is found, read line by line from the text file, can anyone point out why this error occurs? Cheers<BR><BR>Robert Smith<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Still not working...

    I can make no sense of why you would get a Server.CreateObject error on that line. <BR><BR>Have you checked to see how far you have gotten in the file, up to this point? That is, have you modified the code to do *something* like this:<BR><BR>...<BR>strdate = objopenfile.readline<BR>Response.Write "DEBUG: strdate is " & strdate & "&LT;BR&#062;" & vbNewLIne<BR>strdate = dateadd("d",strdatenumber,strdate)<BR>do while not bolfound = true <BR> &nbsp; strcontents = objopenfile.readline &#060;&#060;ERROR HERE&#062;&#062;<BR> &nbsp; Response.Write "DEBUG: strdcontents is " & strcontents & "&LT;BR&#062;" & vbNewLIne<BR> &nbsp; if Instr(1,strcontents,strdate,1) then bolfound = true<BR>loop<BR>...<BR><BR>I am most suspicious that you have "fallen off" the end of the file, though I admit that I think you would then get a different error than the one you are reporting.<BR><BR>Incidentally, you are *NOT* check for the end of file in *either* of your loops, are you? Isn&#039t that a huge potential for an error/bug?<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts