Select * From variable

Results 1 to 2 of 2

Thread: Select * From variable

  1. #1
    River Guest

    Default Select * From variable

    I would like to use user posted variable as the table name in the SQL "Select * From ??" statement.<BR>It is possible , if so, how can I do it ?<BR>thanks

  2. #2
    Join Date
    Dec 1969

    Default very, very simple

    There&#039s nothing special about a table name. It&#039s just another string. So just do:<BR><BR>&#060;%<BR>... you create and open the connection object "conn" ...<BR><BR>SQL = "SELECT * FROM " & Request.Form("userSelectedTableName")<BR><BR>Set RS = conn.Execute( SQL )<BR>...<BR>%&#062;<BR><BR>where I presume that the field you are getting is from a drop down list of table names, yes? You surely wouldn&#039t want people to simply type in a table name, else you could get an error when you execute the query if the table doesn&#039t exist.<BR><BR>

Posting Permissions

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