% db_path = "database/cnbruce.mdb" Set conn= Server.CreateObject("ADODB.Connection") connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="Server.MapPath(db_path) conn.Open connstr %> |
!--#include file="conn.asp" --> % Set rs = Server.CreateObject ("ADODB.Recordset") sql = "Select * from cnarticle" rs.Open sql,conn,1,1 %> % if rs.EOF and rs.BOF then response.write ("暂时还没有文章") else Do Until rs.EOF response.write("文章标题是:" rs("cn_title")) response.write("br>文章作者是:" rs("cn_author")) response.write("br>文章加入时间是:" rs("cn_time")) response.write("br>文章内容是:" rs("cn_content")) response.write("hr>") rs.MoveNext Loop end if %> % rs.close Set rs = Nothing conn.close set conn=Nothing %> |