ASP中数据连接问题

来源:百度知道 编辑:UC知道 时间:2024/05/10 11:10:54
请人帮我看下这代码,为什么运行时没任何显示
程序包含两个文件
conn.asp中
<%
dim conn
set conn=server.createobject("adodb.connection")
conn.open "sb","sa","777"
%>
index.asp中
<title>数据连接</titel>
<!--#include file="conn.asp" -->
<center><h4>显示数据库中表的内容</h4></center>
<hr>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from customers"
rs.open sql,conn,1,1
with response
if rs.eof then
response.write "现在数据库为空"
else
response.write "<table border=1 cellspace=0 cellpadding=5>"&_
"<tr height=12><td width=50><b>编号</b></td>"&_
"<td width=100><b>名称</b></td>"&_
"<td width=200><b>地址</b></td>"&_
"<td width=80><b>电话</b&

把这两行删了,在你这里没起作用:
with response
end with
而且循环体要放到end if前面。

<title>数据连接</titel>
<!--#include file="conn.asp" -->
<center><h4>显示数据库中表的内容</h4></center>
<hr>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from customers"
rs.open sql,conn,1,1
if rs.eof then
response.write "现在数据库为空"
else
response.write "<table border=1 cellspace=0 cellpadding=5>"&_
"<tr height=12><td width=50><b>编号</b></td>"&_
"<td width=100><b>名称</b></td>"&_
"<td width=200><b>地址</b></td>"&_
"<td width=80><b>电话</b></td></tr>"
do until rs.eof
response.write "<tr height=12><td width=50>"&rs.fields("custid&q