ASP显示指定的几条记录..如...ID=3 ID=4 ID=5

来源:百度知道 编辑:UC知道 时间:2024/07/01 12:39:14
<%strsql="select * from pro_list where id="&108
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn, 1, 3
while not rs.eof %>
<%=rs("pro_name") %></td>
</tr>
<tr>
<td><%= left(rs("pro_info"),160) %>
<%
rs.movenext
wend
rs.close
%></td>
</tr>
</table>
</div></td>
<td height="240" valign="top"><div align="center">
<table width="300" border="0">
<tr>
<td><%strsql="select * from pro_list where id="&107
set rs = Server.C

你的写的太乱了
<%strsql="select * from pro_list where id in("&id&") order by id desc" '此处ID为你获取的ID
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn, 1, 3
while not rs.eof
%>
<table width="300" border="0">
<tr>
<td>
<%=rs("pro_name") %></td>
</tr>
<tr>
<td><%= left(rs("pro_info"),160) %>
<%
rs.movenext
wend
rs.close
%></td>
</tr>
</table>

Select * From Table Where ID=3 Or ID=4 Or ID=5