ASP显示记录为什么不行啊?

来源:百度知道 编辑:UC知道 时间:2024/06/07 05:16:18
<!--#include file=conn.asp-->
<%
dim chaxunneirong
chaxunneirong = request.form("textfield")

set rs=server.CreateObject("adodb.recordset")
sqlstr="select * from tongxun where name Like '*"&chaxunneirong&"*'"
response.write sqlstr
rs.open sqlstr,conn,1,3
rs.movelast
while not rs.eof
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body text="#330000">
<hr>
<%

if not rs.eof then
%>

<table width="75%" border="1" align="center" cellspacing="2" bordercolor="#FFFFFF">
<tr bgcolor="#009900">
<td width="15%" height="26" bordercolor="1&

1、模糊搜索like 后面的*改成%:

sqlstr="select * from tongxun where name Like '%"&chaxunneirong&"%'"

2、response.write sqlstr 去掉
3、rs.movelast 和紧接着的while not rs.eof 去掉
4、loop后面的end if换行(注意end和if中间有空)

QQ:156558098

把rs.movelast 去掉~