"select * from [table] where text='"&text&"' and selecttext='"&selectText&"'"
把table变成变量不就解决了吗?
如
Dim table
table=Request("TabelName")
"select * from "&table&" where text='"&text&"' and selecttext='"&selectText&"'"
OK,8楼的大哥已经给你解决了,其中的[table]就是你要查询的表明,text是下拉列表的值,selectText是文本框的值!
例如你要查询的表是 user ,把[table]换成 user 就OK了~~~~~~~~~~
id username usertel usertell useradd userwork
1 123 110 117 yyy kkk
表名:ws
表单:
<form name="form1" method="post" action="pic_search.asp">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80%">电子名片搜索
<input size="24" name="text1" type="text" id="text1" onfocus=this.select()
onclick="if(this.value=='请输入要查找的内容'){this.value='';}" onmouseover=this.focus() value="请输入要查找的内容"> <select name="text2" size="1" id="text2">
<option value="username">姓名</option>
<option value="usertel">电话</option>
<option value="usertell">手机</option>
<option value="userwork">职位</option>
<option value="useradd">地址</option>
</select></td>
<td width="20%"><input name="imageField" type="image" src="../photo/searchbutton.gif" width="64" height="24"></td>
</tr>
</table>
</form>
[此贴子已经被作者于2005-11-19 16:11:08编辑过]