最新下载
热门教程
- 1
 - 2
 - 3
 - 4
 - 5
 - 6
 - 7
 - 8
 - 9
 - 10
 
asp连接access数据库 方法
时间:2022-07-02 22:39:36 编辑:袖梨 来源:一聚教程网
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
相关文章
- 过山车之星2游乐园声誉提升方法分享 11-04
 - 过山车之星2独特景点作用介绍说明 11-04
 - 炉石传说标准模式轮盘术卡组推荐分享 11-04
 - 炉石传说标准小行星萨卡组推荐分享 11-04
 - 炉石传说基尔加丹轮盘术卡组推荐分享 11-04
 - 炉石传说宇宙彩虹DK高胜率卡组推荐分享 11-04