SQL如何根据不同变量而打开不同的表?

在ASP程序中如何根据接受到的不同变量而打开不同的表?SQL语句如何写?
---------------------------------------------------------------

Dim i,tableName
i=Requset.Form("aaa")
if (i=="1") then
tableName ="table1"
else
tableName ="table2"
End if

strSQL ="select * from " & tabelName
...............
---------------------------------------------------------------

tabelname="students"
sql="select * from "&tabelname
---------------------------------------------------------------

這個問題給100分?太浪費了

其實sql語句是一個字符串

字符串中的表名你把她當成一個變量來處理就可以了
---------------------------------------------------------------

hehe

Published At
Categories with Web编程
Tagged with
comments powered by Disqus