CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 1999
    Location
    NY
    Posts
    906

    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


  2. #2
    Join Date
    Dec 1999
    Posts
    1

    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



  3. #3
    Join Date
    Nov 1999
    Location
    NY
    Posts
    906

    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'.





  4. #4

    Re: VBScript syntax for ASP/ADO

    tableSQL = "SELECT * FROM " & chr(34) & Request("tableName") & chr(34)

    Charlie Zimmerman
    http://www.freevbcode.com


  5. #5
    Join Date
    Nov 1999
    Location
    NY
    Posts
    906

    Re: VBScript syntax for ASP/ADO

    Thanks. That worked great !


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured