0

Hey guys im having an issue with a text file going past the end of file when its reading the lines even if there is text inside it...

<% 
  // Gets the request

  var strQuery = Request("Show") + "";
  var fso = Server.CreateObject("Scripting.FileSystemObject"); 
  var errorMsg = false;
  var strError = "";   
  var txtFile;
  var all = "all.txt";
  var latest = "latest.txt";
 
     // If we have an all
     if(strQuery == "all")
     {      
	 	txtFile = fso.OpenTextFile(Server.MapPath("all.txt"),1);    //    Open All.txt
	 }
     // Else if We have a Latest 
     if( strQuery == "latest") 
     {
       	//Open Latest.txt
        txtFile = fso.OpenTextFile(Server.MapPath("latest.txt"), 1); 
	}

     function display()
     {
       %>
        <table>
       <%
         do{
            // READ MY LINES
                        FirstName = txtFile.ReadLine(); 
/* LINE 36 >>>>>>>*/    LastName = txtFile.ReadLine();
			phone = txtFile.Readline();
			email = txtFile.Readline();
			street = txtFile.Readline();
			suburb = txtFile.Readline();
			city = txtFile.Readline();
			country = txtFile.Readline();
			check1 = txtFile.Readline();
			check2 = txtFile.Readline();
			check3 = txtFile.Readline();
			budget = txtFile.Readline();
			building_style = txtFile.Readline();
			zone = txtFile.Readline();
			single_or_multiple = txtFile.Readline();
			extension = txtFile.Readline();
			accom_type = txtFile.Readline();
			square_metre = txtFile.Readline();
			area = txtFile.Readline();
			kitchen_area = txtFile.Readline();
			bedrooms = txtFile.Readline();
			bathrooms = txtFile.Readline();
			garages = txtFile.Readline();
			special_features = txtFile.Readline();
			land_scaping = txtFile.Readline();
			mother_in_law = txtFile.Readline();


        %>
         <tr>
           <td>First Name</td><td><%=FirstName%></td>
         </tr>

         <tr>
           <td>Last Name</td><td><%=LastName%></td>
         </tr>
             <tr>
             <td>Phone</td><td><%=phone%></td>
            </tr>
            <tr>
             <td>Email</td><td><%=email%></td>
            </tr>
            <tr>
             <td>Street Address</td><td><%=street%></td>
            </tr>
            <tr>
             <td>Suburb</td><td><%=suburb%></td>
            </tr>
            <tr>
             <td>City</td><td><%=city%></td>
            </tr>
            <tr>
             <td>Country</td><td><%=country%></td>
            </tr>
            <tr>
             <td>Service</td>
             <table><tr><td><%=check1%></td>
            </tr>
            <tr>
            <td><%=check2%></td>
            </tr>
            <tr>
            <td><%=check3%></td>
            </tr></table>
            </tr>
            <tr>
             <td>Budget</td><td><%=budget%></td>
            </tr>
            <tr>
             <td>Building Style</td><td><%=building_style%></td>
            </tr>
            <tr>
             <td>Zone</td><td><%=zone%></td>
            </tr>
            <tr>
             <td>Single or Multiple Dwelling</td><td><%=single_or_multiple%></td>
            </tr>
            <tr>
             <td>Is it an extension</td><td><%=extension%></td>
            </tr>
            <tr>
             <td>Accomodation</td><td><%=accom_type%></td>
            </tr>
            <tr>
             <td>Total land square metres</td><td><%=square_metre%></td>
            </tr>
            <tr>
             <td>Total Building Area</td><td><%=area%></td>
            </tr>
            <tr>
             <td>Kitchen</td><td><%=kitchen_area%></td>
            </tr>
            <tr>
             <td>Bedrooms</td><td><%=bedrooms%></td>
            </tr>
            <tr>
             <td>Bathrooms</td><td><%=bathrooms%></td>
            </tr>
            <tr>
             <td>Garages</td><td><%=garages%></td>
            </tr>
            <tr>
             <td>Special Features</td><td><%=special_features%></td>
            </tr>
            <tr>
             <td>Land Scaping</td><td><%=land_scaping%></td>
            </tr>
            <tr>
             <td>Colour scheme by Mother in law?</td><td><%=mother_in_law%></td>
            </tr>
            <tr>
             <td>******End of Job******</td><td>&nbsp;</td>
            </tr>
                </table>
        <%
		  } while(!txtFile.AtEndOfStream);
		  // while
	 }
	 // End of function
	 %>

This is the whole code from the asp side of it... and this is the error
Error Type:
Microsoft JScript runtime (0x800A003E)
Input past end of file
/s8/site/job_show.asp, line 36

any help PLEASE!

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by ghost_from_sa
0

Never mind i got it for those who want it in future reference its just because my stupid mistake was not having enough readline fields... so make sure you account for extra lines in your text file

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.