急,小弟请问asp的字段查询问题?

来源:百度知道 编辑:UC知道 时间:2024/07/03 05:10:50
急,小弟请问asp的字段查询问题?

请问要查询某个表中的某一行的某一字段的值怎么写?比如我要查询第五行,name字段的值。

用sql语句怎么写?用asp语句怎么写?

<!--#include file="conn.asp"-->
<%
set rs=Server.CreateObject("ADODB.Recordset")
sql="select * from name where id=5"
rs.open sql,conn,3,1
if rs.eof then
response.Write "<Script Language=Javascript>window.alert('对不起,没有!');location.href='javascript:history.go(-1)';</Script>"
response.end
else%>
<%=rs("name")%>
<%end if%>

haha~~~

sql="select name from table where id=5"
查询多个字段就用
sql="select name,school,class from table where id=5"