VBScript syntax for ASP/ADO
I need to form a string in VBScript with double quotes in it. How do I do that ?
Ex:
DIM tableSQL
tableSQL = "SELECT * FROM " & Request("tableName")
' tableSQL should come out as
' SELECT * FROM "Order Details"
Truly appreciate your response.
Kailash
Re: VBScript syntax for ASP/ADO
This should work...
Ex. dim SQ as string
SQ = "Select * " & _
"From OrderDetails"
datRecSel.recordsource = SQ
'Make sure that you place a data control on your form called datRecSel
datRecSel.refresh
'this updates the data source to your query data
If you meant that you wanted to use a table name to select in the query then simply do something like this...
SQ = "Select * " & _
"From '" & txtTableReq.txt & "'"
Please note: this is assuming that the table name comes from a text control named txtTableReq
Re: VBScript syntax for ASP/ADO
Thanks for your response.
I tried that and the select statement comes out as
SELECT * FROM 'Order Details'
SQL Server treats 'Order Details' as a string and not a table and I get
Microsoft OLE DB Provider for SQL Server error '80040e14'
Line 1: Incorrect syntax near 'Order Details'.
Re: VBScript syntax for ASP/ADO
tableSQL = "SELECT * FROM " & chr(34) & Request("tableName") & chr(34)
Charlie Zimmerman
http://www.freevbcode.com
Re: VBScript syntax for ASP/ADO
Thanks. That worked great !