考虑到以下情况,我想知道链接中的以下使用是否正确
main.asp 页面
<a href="http://details.asp?number between 01 and 08>)
click here for number between 1 and 8
</a>
这是访问中的查询
select * from table
where right("000" & number,2) between [enter start number] and [enter end number]
这是访问中的表
number| field1| field2| field3
1 | xys | abc | at
2 |sdfd | dfasd | dd
3 | sdfd | ddd | dd
下面是details.asp代码
<html>
<body>
<%
Dim numCategoryID
numCategoryID = Request.Querystring("number")
set conn=Server.CreateObject("ADODB.Connection")
conn.open "query"
set rs = Server.CreateObject("ADODB.recordset")
strQuery = "queryname '" & numCategoryID & "'"
rs.Open strQuery, conn
%>
<table border="1" width="100%">
<tr>
<%for each x in rs.Fields
response.write("<th>" & x.name & "</th>")
next%>
</tr>
<%do until rs.EOF%>
<tr>
<%for each x in rs.Fields%>
<td><%Response.Write(x.value)%></td>
<%next
rs.MoveNext%>
</tr>
<%loop
rs.close
conn.close
%>
</table>
</body>
</html>
如果上面的代码有任何错误,请告诉我。实际上,当我单击链接 main.asp 时,它应该打开查询 where number between 1 和 8。
当用户在表单中输入两个数字时,这是我第三次尝试在两个数字之间获得输出
<%
dim startnumber, endnumber
startnumber = Request.form("number")
endnumber = Request.form("number")
set conn=Server.CreateObject("ADODB.Connection")
conn.open "connection"
set rs = Server.CreateObject("ADODB.recordset")
strQuery = "SELECT * from query " _
& "where number between" & startnumber_
& "& endnumber;
rs.Open strQuery, conn
%>
<table border="1" width="100%">
<tr>
<%for each x in rs.Fields
response.write("<th>" & x.name & "</th>")
next%>
</tr>
<%do until rs.EOF%>
<tr>
<%for each x in rs.Fields%>
<td><%Response.Write(x.value)%></td>
<%next
rs.MoveNext%>
</tr>
<%loop
rs.close
conn.close
%>
</table>
</body>
</html>