use a variable for -table selection- in my ASP SQL statement

use a variable for -table selection- in my ASP SQL statement

am 12.10.2004 17:11:05 von tghetti

Hi All,
I have a small issue that I can't seem to figure out. I have a SQL
statement that is dependant on the results of a drop down to chose
which table to select from. Unfortunately it does not seem to work.
Could anyone point me in the right direction? Unfortunately the
datebase cannot be changed.

I guess my question is this. Is it possible to use a variable in a SQl
select statement to choose the table? If so, where is my syntax bad.
If not, how can i get around this without changing the database

Thanks in advance!


*** here's some of the code!!



<%
fp_sQry="SELECT * FROM eqtable ORDER BY category"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="Inventory"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=True
fp_sMenuChoice="Category"
fp_sMenuValue="Category"
fp_iDisplayCols=1
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>







<%
fp_sQry="SELECT Name FROM " & Category & " ORDER BY Name"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="Inventory"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=True
fp_sMenuChoice="Sub_Category"
fp_sMenuValue="Sub_Category"
fp_iDisplayCols=1
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<%
IF Request.Form("Category") = "" Then
Else
%>


">

<%End IF%>

Re: use a variable for -table selection- in my ASP SQL statement

am 12.10.2004 17:12:36 von ten.xoc

http://www.aspfaq.com/5003

--
http://www.aspfaq.com/
(Reverse address to reply.)




"Tim" wrote in message
news:5039f16b.0410120711.6383d8a3@posting.google.com...
> Hi All,
> I have a small issue that I can't seem to figure out. I have a SQL
> statement that is dependant on the results of a drop down to chose
> which table to select from. Unfortunately it does not seem to work.
> Could anyone point me in the right direction? Unfortunately the
> datebase cannot be changed.
>
> I guess my question is this. Is it possible to use a variable in a SQl
> select statement to choose the table? If so, where is my syntax bad.
> If not, how can i get around this without changing the database
>
> Thanks in advance!
>
>
> *** here's some of the code!!
>
>


>
>

<%
> fp_sQry="SELECT * FROM eqtable ORDER BY category"
> fp_sDefault=""
> fp_sNoRecords="No records returned."
> fp_sDataConn="Inventory"
> fp_iMaxRecords=256
> fp_iCommandType=1
> fp_iPageSize=0
> fp_fTableFormat=False
> fp_fMenuFormat=True
> fp_sMenuChoice="Category"
> fp_sMenuValue="Category"
> fp_iDisplayCols=1
> fp_fCustomQuery=False
> BOTID=0
> fp_iRegion=BOTID
> %>
>
>
>


>

>
>

>
>

<%
> fp_sQry="SELECT Name FROM " & Category & " ORDER BY Name"
> fp_sDefault=""
> fp_sNoRecords="No records returned."
> fp_sDataConn="Inventory"
> fp_iMaxRecords=256
> fp_iCommandType=1
> fp_iPageSize=0
> fp_fTableFormat=False
> fp_fMenuFormat=True
> fp_sMenuChoice="Sub_Category"
> fp_sMenuValue="Sub_Category"
> fp_iDisplayCols=1
> fp_fCustomQuery=False
> BOTID=0
> fp_iRegion=BOTID
> %>
> <%
> IF Request.Form("Category") = "" Then
> Else
> %>
>
>


> ">
>

> <%End IF%>