熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

asp 數據庫連接代碼與數據庫關閉代碼

2022-06-13   來源: .NET編程 

  dim connrs;//這裡如果是調用外部文件就必須定義這裡
這裡是數據庫創建聯連方法

  sub opendb()
        set rs=serverCreateObject("adodbrecordset")
        set conn=serverCreateObject("adodbconnection")
        connconnectionstring="provider=microsoftjetoledb; data source="&servermappath("datasource/hhinfomdb")
        connopen
    end sub

  //這裡是asp數據關閉方法
    sub closedb()
        if isobject(rs) then
            if not(rs is nothing) then
                rsclose
                set rs=nothing
            end if
        end if
        if isobject(conn) then
            if not(conn is nothing) then
                connclose
                set conn=nothing
            end if
        end if
    end sub


From:http://tw.wingwit.com/Article/program/net/201311/13341.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.