read data from file error message this program, that reads data from file , works <%const forreading = 1 const tristateusedefault = -2 Dim FSO, TextStream, S set FSO = server.createobject("Scripting.FileSystemObject") Set FSO = CreateObject("Scripting.FileSystemObject") Set TextStream = FSpentextfile("c:\testfile.txt",forreading, tristateusedefault) %> <A NAME="closereadfromfile"></A><% S = TextStream.ReadAll & NewLine & NewLine TextStream.Close response.write(S) %> But when I try to use it in another program it doesn't work error message - Microsoft VBScript runtime error '800a01f4' Variable is undefined: 'NewLine'
you're treating "newline" as a variable but not defining it in your dim, or adding any values to it. try "+ newline" instead of "& newline", or remove the "& newline & newline" from your S variable.