⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 conferencedb.vb

📁 visual studio.net学习资料
💻 VB
字号:
Imports System
Imports System.Web
Imports System.Collections

Namespace Conference

    '*******************************************************
    '
    ' Conference Class
    '
    ' A helper Class that encapsulates (and then caches) a 
    ' call out to the ASP+ Config System to obtain a database DSN.  
    ' Administrators can change the application's database
    ' location simply by altering the config.web file in the 
    ' root directory of the application.
    '
    '*******************************************************

    Public Class ConferenceDB 
       
        Shared m_ConnectionString As String

        '*******************************************************
        '
        ' ConferenceDB.ConnectionString Property
        '
        ' The ConferenceDB.ConnectionString property encapsulates
        ' a callout to the ASP+ Config System to obtain the
        ' database connection string for the application.
        '
        '*******************************************************

        Shared ReadOnly Property ConnectionString As String   
        
            Get  

                ' Pull the ConnectionString from the ASP+ AppSettings section.
                ' Cache in static field for faster repeat access.

                If m_ConnectionString = "" Then

                    Dim appsetting As Hashtable = CType(HttpContext.Current.GetConfig("appsettings"), Hashtable)         
                    m_ConnectionString = CStr(appsetting("DSN"))

                    If m_ConnectionString = "" Then
                        throw new Exception("Conference DSN Value not set in Config.web")
                    End if

                End If

                ' Return the Connection String
                return m_connectionString

            End Get
            
        End Property
        
    End Class
    
End Namespace

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -