ASP如何显示SQL中的记录
就是把SQL中的全部记录显示到网页中,用ASP代码实现,最简洁的方法!不好意思,刚开始接触,OrderByidDESC是什么意思?<%@PageLanguage="vb"...
就是把SQL中的全部记录显示到网页中,用ASP代码实现,最简洁的方法!
不好意思,刚开始接触,Order By id DESC是什么意思?
<%@ Page Language="vb" aspcompat=true AutoEventWireup="false"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<%
dim un
dim pa
dim conn
dim rs
dim sql
un=request.form("user_name")
pa=request.form("password")
conn=Server.CreateObject("ADODB.Connection") '创建一个数据库连接对象conn,方便以后调用
conn.open("PROVIDER=SQLOLEDB;DATA SOURCE=QING;UID=sa;PWD=94740;DATABASE=students;")
rs = Server.CreateObject("ADODB.Recordset")
sql ="Select * From student"
RS.open(sql,Conn,1,1)
do while not rs.eof
%>
<%=rs("s_no")%> 列出标题
<%
RS.MoveNext
Loop
rs.close
%>
</body>
</html> 展开
不好意思,刚开始接触,Order By id DESC是什么意思?
<%@ Page Language="vb" aspcompat=true AutoEventWireup="false"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<%
dim un
dim pa
dim conn
dim rs
dim sql
un=request.form("user_name")
pa=request.form("password")
conn=Server.CreateObject("ADODB.Connection") '创建一个数据库连接对象conn,方便以后调用
conn.open("PROVIDER=SQLOLEDB;DATA SOURCE=QING;UID=sa;PWD=94740;DATABASE=students;")
rs = Server.CreateObject("ADODB.Recordset")
sql ="Select * From student"
RS.open(sql,Conn,1,1)
do while not rs.eof
%>
<%=rs("s_no")%> 列出标题
<%
RS.MoveNext
Loop
rs.close
%>
</body>
</html> 展开
1个回答
展开全部
<%
database=1
dbuid="sa"
dbpwd="94740"
dbname="students"
dbip=(local)
set conn=Server.CreateObject("adodb.Connection")
Conn.Open "PROVIDER=SQLOLEDB.1;Data Source="&dbip&";Initial Catalog="&dbname&";Persist Security Info=True;User ID="&dbuid&";Password="&dbpwd&";Connect Timeout=30"
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<table border="0" width="298" id="table1" cellpadding="0" style="border-collapse: collapse" height="45">
<tr>
<td height="22"></td>
</tr>
<%
set rs=server.createobject("adodb.recordset")
sql ="Select * From student"
RS.open sql,Conn,1,1
do while not rs.eof
%>
<tr>
<td height="23"><%=rs("s_no")%></td>
</tr>
<%
RS.MoveNext
Loop
rs.close
%>
</table>
</body>
</html>
database=1
dbuid="sa"
dbpwd="94740"
dbname="students"
dbip=(local)
set conn=Server.CreateObject("adodb.Connection")
Conn.Open "PROVIDER=SQLOLEDB.1;Data Source="&dbip&";Initial Catalog="&dbname&";Persist Security Info=True;User ID="&dbuid&";Password="&dbpwd&";Connect Timeout=30"
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<table border="0" width="298" id="table1" cellpadding="0" style="border-collapse: collapse" height="45">
<tr>
<td height="22"></td>
</tr>
<%
set rs=server.createobject("adodb.recordset")
sql ="Select * From student"
RS.open sql,Conn,1,1
do while not rs.eof
%>
<tr>
<td height="23"><%=rs("s_no")%></td>
</tr>
<%
RS.MoveNext
Loop
rs.close
%>
</table>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询