asp链接acces数据库

=============================== web

'conn.asp sql

<%
Dim connstr
connstr="provider=microsoft.ACE.oledb.12.0;data source=" & server.MapPath("database/Config.mdb")
Set conn = Server.Createobject("ADODB.Connection")
conn.Open connstr
%> 数据库

=============================== ide

show_config.asp 指针

<!--#include file=conn.asp--> 
        <%
         set rs=server.CreateObject("adodb.recordset")  '(创建recordset对象)
         sqlstr="select * from config"  '---->(message为数据库中的一个数据表,即你要显示的数据所存放的数据表)
         rs.open sqlstr,conn,1,3        ' ---->(表示打开数据库的方式) server

  

         rs.movefirst                    '---->(将指针移到第一条记录)
         while not rs.eof                '---->(判断指针是否到末尾)
         response.write(rs("web_name"))   '   ---->(显示数据表message中的name字段)
   'response.write(rs("info"))
   'Response.write("<br/>")
         rs.movenext                     '---->(将指针移动到下一条记录)
         wend                            '---->(循环结束) 对象

  
'------------------------------------------------------        
         rs.close
         conn.close                    '这几句是用来关闭数据库
         set rs=nothing
         set conn=nothing
'-------------------------------------------------------
        %> it

相关文章
相关标签/搜索