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

📄 db.fun

📁 这是一个无纸化测试系统
💻 FUN
字号:
<%
'---------------------------------------------------
Function GetMdbConnection( FileName )
   Dim Provider, DBPath

   Provider = "Provider=Microsoft.Jet.OLEDB.4.0;"
   DBPath = "Data Source=" & Server.MapPath(FileName)
   Set GetMdbConnection = GetConnection( Provider & DBPath )
End Function

'---------------------------------------------------
Function GetSecuredMdbConnection( FileName, Password )
   Dim Provider, DBPath

   Provider = "Provider=Microsoft.Jet.OLEDB.4.0;"
   DBPath = "Data Source=" & Server.MapPath(FileName)
   Set GetSecuredMdbConnection = GetConnection( Provider & DBPath & ";Jet OLEDB:Database Password=" & Password )
End Function

'---------------------------------------------------
Function GetMdbRecordset( FileName, Source )
   Set GetMdbRecordset = GetMdbRs( FileName, Source, 2, "" )
End Function

'---------------------------------------------------
Function GetMdbStaticRecordset( FileName, Source )
   Set GetMdbStaticRecordset = GetMdbRs( FileName, Source, 3, "" )
End Function

'---------------------------------------------------
Function GetSecuredMdbRecordset( FileName, Source, Password )
   Set GetSecuredMdbRecordset = GetMdbRs( FileName, Source, 2, Password )
End Function

'---------------------------------------------------
Function GetSecuredMdbStaticRecordset( FileName, Source, Password )
   Set GetSecuredMdbStaticRecordset = GetMdbRs( FileName, Source, 3, Password )
End Function

'---------------------------------------------------
Function GetConnection( Param )
   Dim conn 

   On Error Resume Next
   Set GetConnection = Nothing
   Set conn = Server.CreateObject("ADODB.Connection")
   If Err.Number <> 0 Then Exit Function

   conn.Open Param
   If Err.Number <> 0 Then Exit Function
   Set GetConnection = conn
End Function

'---------------------------------------------------
Function GetMdbRs( FileName, Source, Cursor, Password )
   Dim conn, rs

   On Error Resume Next
   Set GetMdbRs = Nothing
   If Len(Password) = 0 Then
       Set conn = GetMdbConnection( FileName )
   Else
       Set conn = GetSecuredMdbConnection( FileName, Password )
   End If
   If conn Is Nothing Then Exit Function

   Set rs = Server.CreateObject("ADODB.Recordset")
   If Err.Number <> 0 Then Exit Function

   rs.Open source, conn, Cursor, 2
   If Err.Number <> 0 Then Exit Function
   Set GetMdbRs = rs
End Function
%>

⌨️ 快捷键说明

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