asp最常用的显示代码
连接字符
dim conn,connstr
on error resume next
connstr="DBQ="+server.mappath("./data/db.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
Set conn=Server.CreateObject("ADODB.CONNECTION")
conn.open connstr
显示
<% Set rss=Server.CreateObject("ADODB.RecordSet")
sql="select * from news '"
rss.Open sql,conn,1,1
if rss.eof and rss.bof then
response.Write("数据库出错")
else
%>
<%=rss("content") %>
<%
end if
rss.close
set rss=nothing
%>
sql="select * from news '"
rss.Open sql,conn,1,1
if rss.eof and rss.bof then
response.Write("数据库出错")
else
%>
<%=rss("content") %>
<%
end if
rss.close
set rss=nothing
%>