Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: writing to a text file error


Message #1 by "Nick" <nick@f...> on Wed, 28 Nov 2001 12:15:36
Hi all,



I am having trouble writing a string to a text file. The code is failing 

on the objTS.Write(strData) and the error is:



Microsoft VBScript runtime error '800a0005' 



Invalid procedure call or argument 



/guardian/index.asp, line 126 



The code i have used is below. The string to be written to the text file 

is below that. Any help appreciated.



#####################################################



Dim objTS

Set objTS = objFSO.CreateTextFile("e:\web\fizzin\" & catArr(i,1) & ".asp", 

true)

%><%

' write strData to the new file and close the text stream

objTS.Write(strData)



objTS.Close



#####################################################



strData = <!-- Vignette V/5 Wed Nov 28 10:16:25 2001 -->







	 <TR><TD>

	

		

			<a target='_blank' 

href='http://www.guardian.co.uk/Distribution/Redirect_Artifact/0,4678,0-

608147,00.html' 

			>

				Lottery sales fall for third year

			</A>

		<BR>

		Camelot, the company behind the national lottery, unveiled 

figures yesterday showing that ticket sales are now in their third year of 

decline. <BR>

	 </TD></TR>



	 <TR><TD>

	

		

			<a target='_blank' 

href='http://www.guardian.co.uk/Distribution/Redirect_Artifact/0,4678,0-

607968,00.html' 

			>

				Lloyd's raises claims estimate to ?1.9bn

			</A>

		<BR>

		New insurance claims related to the September 11 terrorist 

atrocities forced the Lloyd's of London insurance market yesterday to 

raise its estimate of the claims it faces by &#163;600m to &#163;1.9bn. 

<BR>

	 </TD></TR>



	 <TR><TD>

	

		

			<a target='_blank' 

href='http://www.guardian.co.uk/Distribution/Redirect_Artifact/0,4678,0-

607937,00.html' 

			>

				Blairs open youth centre to commemorate 

Damilola

			</A>

		<BR>

		There is nothing in the damp stairwell of the North 

Peckham estate to record where schoolboy Damilola Taylor bled to death. 

Only glistening stalactites leach away concrete from the condemned 1960s 

complex. <BR>

	 </TD></TR>



	 <TR><TD>

	

		

			<a target='_blank' 

href='http://www.guardian.co.uk/Distribution/Redirect_Artifact/0,4678,0-

607935,00.html' 

			>

				Hospital errors freed man who killed two

			</A>

		<BR>

		A paranoid schizophrenic man known to have access to guns 

killed two people and injured three more after a catalogue of errors by 

nursing and medical staff led to his release from hospital, an independent 

report stated yesterday. <BR>

	 </TD></TR>



	 <TR><TD>

	

		

			<a target='_blank' 

href='http://www.guardian.co.uk/Distribution/Redirect_Artifact/0,4678,0-

607933,00.html' 

			>

				Police ready to boycott radio system

			</A>

		<BR>

		Police officers are threatening to withdraw support from a 

new digital radio communications system unless the Home Office addresses 

concerns about the potential threat it poses to users' health. <BR>

	 </TD></TR>



	 <TR><TD>

	

		

			<a target='_blank' 

href='http://www.guardian.co.uk/Distribution/Redirect_Artifact/0,4678,0-

607934,00.html' 

			>

				Reveller's ?42,000 round of birthday drinks

			</A>

		<BR>

		Saturday night's burst of unexplained and delirious 

generosity is now a grateful memory in a London nightclub world which had 

thought itself in recession. <BR>

	 </TD></TR>



	 <TR><TD>

	

		

			<a target='_blank' 

href='http://www.guardian.co.uk/Distribution/Redirect_Artifact/0,4678,0-

607957,00.html' 

			>

				Stolen curtain 'key clue' in Sarah case

			</A>

		<BR>

		A curtain stolen from a mother and baby room yesterday 

emerged as a key clue in the case against the man accused of murdering 

Sarah Payne. <BR>

	 </TD></TR>



	 <TR><TD>

	

		

			<a target='_blank' 

href='http://www.guardian.co.uk/Distribution/Redirect_Artifact/0,4678,0-

607979,00.html' 

			>

				Czech court throws out plea to extradite 

Briton

			</A>

		<BR>

		Czech judges yesterday threw out an application from 

Britain for extradition of Chris Denning, the convicted paedophile and 

former Radio 1 DJ, whom police had wanted to interrogate in connection 

with the Jonathan King child abuse case. <BR>

	 </TD></TR>

</TABLE>
Message #2 by "Jason Salas" <jason@k...> on Wed, 28 Nov 2001 22:18:28 +1000
Hi Nick,



Which line exactly in your example is line 126?  Do you declare what data is

in strData as the text string somewhere within your script?  It looks like

it may be a SUB or FUNCTION which is not referenced correctly.



HTH,

Jason





----- Original Message -----

From: "Nick" <nick@f...>

To: "ASP Web HowTo" <asp_web_howto@p...>

Sent: Wednesday, November 28, 2001 12:15 PM

Subject: [asp_web_howto] writing to a text file error





> Hi all,

>

> I am having trouble writing a string to a text file. The code is failing

> on the objTS.Write(strData) and the error is:

>

> Microsoft VBScript runtime error '800a0005'

>

> Invalid procedure call or argument

>

> /guardian/index.asp, line 126

>

> The code i have used is below. The string to be written to the text file

> is below that. Any help appreciated.

>

> #####################################################

>

> Dim objTS

> Set objTS = objFSO.CreateTextFile("e:\web\fizzin\" & catArr(i,1) & ".asp",

> true)

> %><%

> ' write strData to the new file and close the text stream

> objTS.Write(strData)

>

> objTS.Close

>

> #####################################################





Message #3 by Nick Charlesworth <nick@f...> on Wed, 28 Nov 2001 12:23:06 -0000
line 126 is: objTS.Write(strData)



The response of an xmlhttp object is assigned to strData



Dim  xmlHTTP

Set xmlHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")

'set the http headers to fetch

xmlHTTP.Open "GET", catArr(i, 0), false

' send the request

xmlhttp.Send 

' assign the response (an html string) to the strData variable

strData = xmlHTTP.responseText









-----Original Message-----

From: Jason Salas [mailto:jason@k...]

Sent: 28 November 2001 12:18

To: ASP Web HowTo

Subject: [asp_web_howto] Re: writing to a text file error





Hi Nick,



Which line exactly in your example is line 126?  Do you declare what data is

in strData as the text string somewhere within your script?  It looks like

it may be a SUB or FUNCTION which is not referenced correctly.



HTH,

Jason





----- Original Message -----

From: "Nick" <nick@f...>

To: "ASP Web HowTo" <asp_web_howto@p...>

Sent: Wednesday, November 28, 2001 12:15 PM

Subject: [asp_web_howto] writing to a text file error





> Hi all,

>

> I am having trouble writing a string to a text file. The code is failing

> on the objTS.Write(strData) and the error is:

>

> Microsoft VBScript runtime error '800a0005'

>

> Invalid procedure call or argument

>

> /guardian/index.asp, line 126

>

> The code i have used is below. The string to be written to the text file

> is below that. Any help appreciated.

>

> #####################################################

>

> Dim objTS

> Set objTS = objFSO.CreateTextFile("e:\web\fizzin\" & catArr(i,1) & ".asp",

> true)

> %><%

> ' write strData to the new file and close the text stream

> objTS.Write(strData)

>

> objTS.Close

>

> #####################################################










$subst('Email.Unsub')



Read the future with ebooks at B&N

http://service.bfast.com/bfast/click?bfmid=2181&sourceid=38934667&categoryid

=rn_ebooks

Message #4 by "Daniel O'Dorisio" <daniel@o...> on Wed, 28 Nov 2001 07:41:48 -0500
i think you need quotes arround your string.. try it see if it works..



> strData = "<!-- Vignette V/5 Wed Nov 28 10:16:25 2001 -->"





daniel



--

-----------------------------

Daniel O'Dorisio

daniel@o...

www.odorisio-networks.com

-----------------------------





Message #5 by Nick Charlesworth <nick@f...> on Wed, 28 Nov 2001 13:13:27 -0000
strData has a value assigned to it in the following line so no quotes are

needed.



strData = xmlHTTP.responseText



The xmlHTTP.responseText spans many lines (see my original post).





-----Original Message-----

From: Daniel O'Dorisio [mailto:daniel@o...]

Sent: 28 November 2001 12:42

To: ASP Web HowTo

Subject: [asp_web_howto] Re: writing to a text file error





i think you need quotes arround your string.. try it see if it works..



> strData = "<!-- Vignette V/5 Wed Nov 28 10:16:25 2001 -->"





daniel



--

-----------------------------

Daniel O'Dorisio

daniel@o...

www.odorisio-networks.com

-----------------------------










$subst('Email.Unsub')



Read the future with ebooks at B&N

http://service.bfast.com/bfast/click?bfmid=2181&sourceid=38934667&categoryid

=rn_ebooks

Message #6 by Nick Charlesworth <nick@f...> on Wed, 28 Nov 2001 13:52:21 -0000
I think it is something to do with the strData as if i do:



strChar = Left(strChar, 46)



before trying to write it to the textstream this leaves strChar with a value

of "<!-- Vignette V/5 Wed Nov 28 10:16:25 2001 -->"



and this does not cause an error when writing it to the text stream.



Any ideas? 



-----Original Message-----

From: Daniel O'Dorisio [mailto:daniel@o...]

Sent: 28 November 2001 12:42

To: ASP Web HowTo

Subject: [asp_web_howto] Re: writing to a text file error





i think you need quotes arround your string.. try it see if it works..



> strData = "<!-- Vignette V/5 Wed Nov 28 10:16:25 2001 -->"





daniel



--

-----------------------------

Daniel O'Dorisio

daniel@o...

www.odorisio-networks.com

-----------------------------










$subst('Email.Unsub')



Read the future with ebooks at B&N

http://service.bfast.com/bfast/click?bfmid=2181&sourceid=38934667&categoryid

=rn_ebooks

Message #7 by "Daniel O'Dorisio" <daniel@o...> on Wed, 28 Nov 2001 09:13:51 -0500
sorry that is not mentioned in your original post.. i looked at the second

and see what you are saying..



but you are now talking about strChar.. im confused..





daniel



--

-----------------------------

Daniel O'Dorisio

daniel@o...

www.odorisio-networks.com

-----------------------------

"Nick Charlesworth" <nick@f...> wrote in message

news:124074@a..._web_howto...

>

> strData has a value assigned to it in the following line so no quotes are

> needed.

>

> strData = xmlHTTP.responseText

>

> The xmlHTTP.responseText spans many lines (see my original post).

>

>

> -----Original Message-----

> From: Daniel O'Dorisio [mailto:daniel@o...]

> Sent: 28 November 2001 12:42

> To: ASP Web HowTo

> Subject: [asp_web_howto] Re: writing to a text file error

>

>

> i think you need quotes arround your string.. try it see if it works..

>

> > strData = "<!-- Vignette V/5 Wed Nov 28 10:16:25 2001 -->"

>

>

> daniel

>

> --

> -----------------------------

> Daniel O'Dorisio

> daniel@o...

> www.odorisio-networks.com

> -----------------------------

>

>

>




> $subst('Email.Unsub')

>

> Read the future with ebooks at B&N

>

http://service.bfast.com/bfast/click?bfmid=2181&sourceid=38934667&categoryid

> =rn_ebooks

>

>






  Return to Index