Click to See Complete Forum and Search --> : VBScript syntax for ASP/ADO
Kailash Marthi
December 17th, 1999, 10:08 AM
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
tagreid
December 17th, 1999, 10:48 AM
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
Kailash Marthi
December 17th, 1999, 11:01 AM
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'.
czimmerman
December 17th, 1999, 05:06 PM
tableSQL = "SELECT * FROM " & chr(34) & Request("tableName") & chr(34)
Charlie Zimmerman
http://www.freevbcode.com
Kailash Marthi
December 17th, 1999, 05:19 PM
Thanks. That worked great !
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.