Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 30th, 2009, 11:43 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default write value as string using FSO to ASP file

How can I write a value to an asp file and ensure its a string? The only difficulty I am have is getting the double quotes around the value. EG:

I want (the start of my file):

<%
Const Title_App = ''CERMT''

However I using this code:

OpenFileobj.writeLine("<%")
OpenFileobj.WriteLine("Const Title_App = " & trim(request.form("appName")))

I get:

<%
Const Title_App = CERMT

I have tried all combinations od double double, double single double etc.....but cant seem to get double quotes around the word CERMT. Any ideas would be very helpful?

TYIA
__________________
Wind is your friend
Matt
 
Old August 31st, 2009, 12:46 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

OpenFileobj.WriteLine("Const Title_App = """ & trim(request.form("appName")) & """")
__________________
Om Prakash Pant
Click the "Thanks" button if this post helped you.
The Following User Says Thank You to om_prakash For This Useful Post:
mat41 (August 31st, 2009)
 
Old August 31st, 2009, 02:16 AM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Three doubles then four at the end. A combination I did not try, trhank you om_prakash you have a fine day...
__________________
Wind is your friend
Matt
 
Old August 31st, 2009, 02:34 AM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Any idea why I get an 'Unterminated string constant' on this line:

OpenFileobj.writeLine("%>")

All is well after your assistance however the closing ASP delimiter now seems to be an issue.

TYIA
__________________
Wind is your friend
Matt
 
Old August 31st, 2009, 02:42 AM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Any idea why I get an 'Unterminated string constant' on this line:

OpenFileobj.writeLine("%>")

All is well after your assistance however the closing ASP delimiter now seems to be an issue. Do I need to use the VB code for a % I assume?

TYIA
__________________
Wind is your friend
Matt
 
Old August 31st, 2009, 06:22 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Try:
Code:
OpenFileobj.writeLine("%" & ">")
__________________
Om Prakash Pant
Click the "Thanks" button if this post helped you.
The Following User Says Thank You to om_prakash For This Useful Post:
mat41 (August 31st, 2009)
 
Old August 31st, 2009, 05:03 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

The reason being that you can *NOT* embed <% or %> tags inside of existing <% ... %> tags.

The ASP engine preprocesses those tags before the code is sent to the compiler, and so the compiler gets broken code.
The Following User Says Thank You to Old Pedant For This Useful Post:
mat41 (August 31st, 2009)
 
Old August 31st, 2009, 05:53 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Excellent thank you both for your time, as always very much appreciated :o)
__________________
Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to read /write from MPP file using Asp.Net C# amitsrathore General .NET 1 October 25th, 2013 03:08 AM
ASP write to txt file dizzy1 Classic ASP Basics 7 June 15th, 2010 10:38 PM
FSO in ASP.NET 2.0 kwilliams ASP.NET 2.0 Basics 3 October 31st, 2006 01:57 PM
write file to mac OS using ASP Lamox Classic ASP Basics 0 December 21st, 2004 06:43 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.