asp+access如何实现精确查询?

来源:百度知道 编辑:UC知道 时间:2024/06/08 17:39:02
<form name="frm_Search" method="get" action="Search.asp">
请输入关键字:
<input type="text" name="key" size="10">
<input type="submit" value="搜索">
</form>
<%
Dim strProvider,CNN
strProvider="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
strProvider=strProvider & Server.MapPath("db_Sample.mdb")
Set CNN = Server.CreateObject("ADODB.connection")
CNN.Open strProvider
%>
<%
Dim S_Key,RST,StrSQL
S_Key =Trim(Request("key"))
If S_Key <>"" then
Set RST=Server.CreateObject("ADODB.RecordSet")
StrSQL="Select * from T_Sample where U_Name='S_Key' or U_Info='S_Key'"
RST.Open StrSQL,CNN,3,2 '得到搜索后的记录
If RST.BOF or RST.EOF Then
%>
<font color="#FF0000">未找到任何结果!!!&l

<font color="#FF0000">未找到任何结果!!!</font>
你这句是用HTML代码输出的
所以不管有没有搜索到
都会显示这个的
建议你用response write方法输出```