Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

textstream object not working

Status
Not open for further replies.

avikohl

Programmer
Sep 17, 2002
14
IL
Having trouble getting text stream object to work on local iis server.
The following code results in no response to the browser and subsequent requests to the website after this code is run also get no response from the website until iis is reset.

The set ObjectTextS line is the culprit.

When commented out the browser gets a response.

I figure there must be something wrong with the way I've got the website configured in iss since the code here is pretty much straight from a book that I have used in the past to work with files (sams).

Can anyone suggest what the problem might be here?

Code:
<% @ language= vbscript %>
<% option explicit
%>
<html>
<head>
<title>
data fill asp page
</title>
</head>
<body>
<%
			dim out
			const forReading=1
			const forWriting=2
			const forAppending=8
			const tristateUseDefault=-2
			const tristateTrue=-1
			const TristateFalse=0
			dim objFs, objTextS, page, file
			dim strLine
			page=&quot;items.txt&quot;
			file=&quot;c:\webtexts\&quot;&page
			set objFs=server.CreateObject(&quot;scripting.fileSystemObject&quot;)
			if objFs.fileExists(file)=true then
				response.write &quot;<p>file exists</p>&quot;
				set ObjTextS=objFs.openTextFile(file,forReading,tristateFalse)
				strLine= objTextS.readLine
				response.write (&quot;<p>here is the line...</p><p> &quot;&strLine&&quot;</p>&quot;)
				objTextS.close
				set objTextS=nothing
			else
				response.write &quot;<p>file does not exists</p>&quot;
			end if


			set objFs=nothing
response.write(&quot;<h1>hi from datafill</h1>&quot;)
%>
 
you need to declare the msado15.dll if you are going to use ADO constants like forReading:

<!-- METADATA TYPE=&quot;typelib&quot; FILE=&quot;C:\Program Files\Common Files\System\ado\msado15.dll&quot; --> Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
Would it work without the dll If I write instead write
set ObjTextS=objFs.openTextFile(file,1,0)

?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top