all groups > inetserver asp db > march 2004 >
You're in the

inetserver asp db

group:

Problems with Using VB to Write VB Script


Re: Problems with Using VB to Write VB Script Bob Barrows
3/31/2004 7:42:23 AM
inetserver asp db: [quoted text, click to view]

You'll probably get better response posting to a relevant vb newsgroup in
the future. This is a vb question, not asp or vbscript.

My suggestion would be to assign that entire string to a variable and
attempt to write it to the debug window. I don't remember if there is a
difference in the way strings are handled by the debug.print method vs the
Print # statement.

You might also consider using the filesystemobject and teststream objects
instead of the deprecated Print # statement.

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Re: Problems with Using VB to Write VB Script Bob Barrows
3/31/2004 7:53:18 AM
[quoted text, click to view]

Oh wait. I see the problems. Start off by breaking this string down (I still
suggest you assign it to a variable to make debugging easier). Let's start
with the very first line:

stop
str="Response.Write ""<a target="""_top"""
debug.print str

You have 3 quotes after target=. The third quote ends the string. I doubt
that's what you intended. Let's correct that and move on:

str="Response.Write ""<a target=""_top"""
debug.print str
str=str & href="""OrderItem.asp?EUPartNo=""
debug.print str

Again, we have an error: We have no delimiter to start the string, an extra
quote after href=, and no quote to end the string. Let's fix that:

str="Response.Write ""<a target=""_top"""
debug.print str
str=str & "href=""OrderItem.asp?EUPartNo="""
debug.print str

Then continue adding the bits on until it prints correctly to the debug
window. Then, comment out all the debug.print's and end with this statement:
Print #1,str

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Problems with Using VB to Write VB Script Roger Stenson
3/31/2004 9:43:35 AM
Hi all
I have a working ASP System containing the code listed under 'Target Code
in a longish loop which reproduces on the web page
the sections of the customer catalogue that the client is interested in. The
code determines if a Customer has logged on and tailors some of the links on
the Catalogue accordingly

To speed up the system I am writing a batch vb application which outputs the
whole web page as static code accessed by bookmarks
However for certain sensitive sections of the Catalogue I wish continue to
insert the following script segment which prevents access to the Ordering
page unless the user is signed on.


Target Code
<%If Session("CustomerID") = "" Then
Response.Write "<tr><td class = col1>" & rsPart("PartNo") & "</td>"
Response.Write "<td class = col2>" & rsPart("Description") &
"</td></tr>"
Else
Response.Write "<tr><td class = col1>" & rsPart("PartNo") & "</td>"
Response.Write "<td class = col2>"
'Write hyperlink to the drawing
Response.Write "<a target=""_top"" href=""OrderItem.asp?EUPartNo="
& rsPart("PartNo") & "&EUPartDescription=" & rsPart("Description") &
"&Source=" & rsPart("Application") & """>" & rsPart("Description") &
"</a></td></tr>"
End If>%

When I bury the above code inside print statements, Print #1, "
" , adding the necessary "'s to make it reproduce correctly, it all works
till I get to
the penultimate line. VB refuses to write

Print #1, "Response.Write ""<a target="""_top"""
href="""OrderItem.asp?EUPartNo="" & rsPart(""PartNo"") &
""&EUPartDescription="" & rsPart(""Description"") & ""&Source="" &
rsPart(""Application"") & """">"" & rsPart(""Description"") &
""</a></td></tr>"""

The compiler says that "_" is an illegal character. If I take out the
'target = _top"" bit, it points at the '?' after 'asp' and says 'Expression
required"

I would be very grateful for some advice on how to code my way past this
problem

Roger Stenson

AddThis Social Bookmark Button