教程集 www.jiaochengji.com
教程集 >  脚本编程  >  Asp  >  正文 asp连接access数据库 方法

asp连接access数据库 方法

发布时间:2016-10-07   编辑:jiaochengji.com
教程集为您提供asp连接access数据库 方法等资源,欢迎您收藏本站,我们将为您提供最新的asp连接access数据库 方法资源
asp数据库连接方法很多的特别是asp与access数据库有几种今天我们讲到的连接access数据库 可以说是最好的方法了

asp数据库连接方法很多的特别是asp与access数据库有几种今天我们讲到的连接access数据库 可以说是最好的方法了

先定义了Rs,Conn为全局变量,这样在其它文件调整当前文件时就可以直接使用了.

 Dim Rs,Conn
 
 Sub Db_connect()
  Dpath ="dbaseMateyDBWeb_^%$#@.mdb"
  Set Conn=Server.CreateObject("Adodb.connection")
  Set Rs =Server.CreateObject("Adodb.Recordset")
  Conn.connectionstring="Provider=Microsoft.Jet.oledb.4.0;Data source="&Server.MapPath(Dpath)
  Conn.open
 End sub

这里关判断rs与conn是否创建了,如果对象存在就关闭,这样可以节省系统资源.
 
 sub closedb()
  if isobject(Rs) then
   if not(Rs is nothing) then
    Rs.close
    set Rs=nothing
    end if
   end if
  if isobject(Conn) then
   if not(Conn is nothing) then
    Conn.close
    set Conn=nothing
   end if
  end if
 end sub

您可能感兴趣的文章:
asp 连接access数据库二种方法
asp连接access数据库 方法
php怎么连接access数据库
php连接access数据库的三种方法
asp access入门级数据库连接文件
asp 全面安全数据连接代码
asp 字符串连接数据库方法
常见的80004005错误及其解决方法
一款完整asp数据库连接程序
php连接Access数据库的方法小结

[关闭]
~ ~