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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MultiLine Strings

Status
Not open for further replies.

mateobus

Programmer
Aug 20, 2007
28
US
Hey,

I have recently run into a bit of annoyance, as I am writing asp pages with extremely long multiline queries. For example, and this is just an example

Dim query
query = "select * " & _
"from table1, table2, table3 " & _
"where table.col1 = table2.col2 " & _
"and cond 1" & _
"and cond 2 "
etc
etc
etc...

The problem is that when I want to test these queries in another program, i have to reformat the queries by deleting all of the quotes and &_ symbols which is really annoying especially with really long queries. Is there a better way to do this. I realize that that's the only way to write multiline strings in vbscript, but is there a better practice out there that people use. I have heard of people storing the queries in xml, but that seems like more trouble than its worth...
 
I typically just cut and paste the vb formatted statement into a dummy vbscript and then wscript.echo the thing, then just copy the results out.

Code:
sMy = "The " & _
	"quick " & _
	"brown " & _
	"fox " & _
	"jumps " & _
	"over " & _
	"the " & _
	"lazy " & _
	"dog."

WScript.Echo sMy

PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top