请帮我看看这段ASP查询代码!高分悬赏!

来源:百度知道 编辑:UC知道 时间:2024/06/05 09:17:54
我想实现ASP到Access的查询功能
Class_no T_name_CN C_name_CN
111 我 张三
111 我 李四
111 我 王五
222 你 赵六
333 你 刘七
代码如下:
<!--#include file="conn.asp"--> 连接我的文件
<%var1=request.querystring("var1")%> 其中VAR1为传送过来的参数
<%Dim S_Key,RST,StrSQL
S_Key = Trim(var1)
If S_Key <>"" then
Set RST=Server.CreateObject("ADODB.RecordSet")
StrSQL="Select * from C_info where Class_NO like '"&var1&"'"
RST.Open StrSQL,conn,1,1
If RST.BOF And RST.EOF Then
%><title>搜索结果.....</title>
<font color="#FF0000">Sorry,未找到任何结果!</font>
<%
Else
While Not RST.EOF

把你rst循环里面的set show去掉
直接用rst对象就可以显示出来的东西为什么还要在循环里面加一个对象?
<!--#include file="conn.asp"--> 连接我的文件
<%var1=request.querystring("var1")%> 其中VAR1为传送过来的参数
<%Dim S_Key,RST,StrSQL
S_Key = Trim(var1)
If S_Key <>"" then
Set RST=Server.CreateObject("ADODB.RecordSet")
StrSQL="Select * from C_info where Class_NO like '"&var1&"'"
RST.Open StrSQL,conn,1,1
If RST.BOF And RST.EOF Then
%><title>搜索结果.....</title>
<font color="#FF0000">Sorry,未找到任何结果!</font>
<%
Else
While Not RST.EOF
%>
<hr size="1">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="34">
<tr>
<td width="50%"