Wrox Programmer Forums
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 4th, 2007, 08:35 PM
Authorized User
Join Date: Sep 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default Replacing a table name with a server variable

Pls Help,

I am used to using something like

strSQL = "SELECT * FROM table_name "_

But I want to put the table_name in a server variable

<% tbl_Search ="FOO" %>

trouble is I cannot get the syntax right in the select statement
single and double quotes always tie me up in knots



Old October 4th, 2007, 09:01 PM
Friend of Wrox
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41

strSQL = "SELECT * FROM " & yourVariablename & " WHERE... "

Wind is your friend
Old October 4th, 2007, 09:24 PM
Wrox Author
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

Bare in mind that you will only ever use ' ' inside of a sql statement when delimiting a string. Integers, bit values, tables names, etc will follow the example matt provided above.


================================================== =========
Read this if you want to know how to get a correct reply for your question:
================================================== =========
Technical Editor for:
Beginning Visual C# 2008
Professional Search Engine Optimization with ASP.NET
Professional IIS 7 and ASP.NET Integrated Programming
Wrox Blox: Introduction to Google Gears
Wrox Blox: Create Amazing Custom User Interfaces with WPF and .NET 3.0
================================================== =========
Old October 4th, 2007, 11:52 PM
Authorized User
Join Date: Sep 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts

I was getting way too complicated, no wonder I failed miserably
Thank you

There is one other thing I am trying to achieve
The script I am using is in a template I built in Dreamweaver but I would like to call the ASP search part from an include file or the like, but again I Cannot get it to work

I need to pass two variables across to the asp script which I have set up in the Template like so:
Dim strSearch ' The number in a specific field I am looking for
Dim tblSearch ' The table I am querying for the result

'These are inputs for each script generated from the template

<% tblSearch ="" %> 'Maximum of 6 alpha chrs
<% strSearch ="" %> 'Maximum of 5 digit number
tblSearch =trim(tblSearch)
strSearch =trim(strSearch)

With which I want to call Myscript.asp when the template script is run Pass it the Vars and and return the record number and retrieve the result to response.write to the screenmost welcome

Thank You


Similar Threads
Thread Thread Starter Forum Replies Last Post
Replacing text in text box inside table Larry Landis Word VBA 0 December 27th, 2007 12:03 PM
Replacing null table entries in select result? TPP SQL Server 2005 6 July 11th, 2007 03:10 AM
table variable query hai SQL Server DTS 5 June 11th, 2007 05:19 AM
Using variable for table name phishcoder SQL Language 0 September 26th, 2006 10:54 PM
Number of table rows to a variable Paula222 Access VBA 2 February 7th, 2006 09:33 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.