指引网

当前位置: 主页 > 编程开发 > ASP >

asp 数据库连接代码与数据库关闭代码

来源:网络 作者:佚名 点击: 时间:2017-08-23 21:47
[摘要] 指引教程为您提供asp 数据库连接代码与数据库关闭代码等资源,欢迎您收藏本站,我们将为您提供最新的asp 数据库连接代码与数据库关闭代码资源
这是一款比较完整的asp 数据库连接代码与数据库关闭代码哦,是多几年前写的喽,现在拿来出给各位朋友看看哈。
<script>ec(2);</script>

 dim conn,rs;//这里如果是调用外部文件就必须定义这里
这里是数据库创建联连方法

    sub opendb()
        set rs=server.CreateObject("adodb.recordset")
        set conn=server.CreateObject("adodb.connection")
        conn.connectionstring="provider=microsoft.jet.oledb.4.0; data source="&server.mappath("datasource/hhinfo.mdb")
        conn.open
    end sub

//这里是asp数据关闭方法
    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

本站原创转载注明:www.111cn.net

------分隔线----------------------------