<
%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>小帆在网页输出指定表中的所有数据</title>
</head>
<body>
<%
dim connstr,sql,conn,rs
connstr="provider=sqloledb;data source=127.0.0.1,1433;User ID=***;pwd=***;Initial Catalog=xiaofan"
sql="select * from xiaofan"
set conn = server.createobject("adodb.connection")
set rs = server.createobject("adodb.recordset")
conn.open connstr
rs.open sql,conn,1,1
'-----------------------------------------------------------------------------
dim i
do while not rs.eof
response.write("<br>")
for i=0 to rs.fields.count-1
response.write rs.fields(i).value
next
rs.movenext
loop
rs.close
set rs = nothing
conn.close
set conn = nothing
%>
<script language="vbscript">
msgbox "SQL conn OK!!", ,"SQL 数据库连接成功!!"
</script>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>小帆在网页输出指定表中的所有数据</title>
</head>
<body>
<%
dim connstr,sql,conn,rs
connstr="provider=sqloledb;data source=127.0.0.1,1433;User ID=***;pwd=***;Initial Catalog=xiaofan"
sql="select * from xiaofan"
set conn = server.createobject("adodb.connection")
set rs = server.createobject("adodb.recordset")
conn.open connstr
rs.open sql,conn,1,1
'-----------------------------------------------------------------------------
dim i
do while not rs.eof
response.write("<br>")
for i=0 to rs.fields.count-1
response.write rs.fields(i).value
next
rs.movenext
loop
rs.close
set rs = nothing
conn.close
set conn = nothing
%>
<script language="vbscript">
msgbox "SQL conn OK!!", ,"SQL 数据库连接成功!!"
</script>
</body>
</html>