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

📄 dlgserver_a.frm

📁 本系统可用于医院和专业体检中心的健康体检管理
💻 FRM
字号:
VERSION 5.00
Object = "{0B81E4A9-BE4E-4AEF-9272-33AB5B51C6FC}#1.0#0"; "XPControls.ocx"
Begin VB.Form dlgServer_A 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "数据库连接属性"
   ClientHeight    =   4545
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   5520
   Icon            =   "dlgServer_A.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4545
   ScaleWidth      =   5520
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   Begin VB.Frame Frame1 
      BackColor       =   &H80000018&
      Caption         =   "服务器信息"
      Height          =   3525
      Left            =   180
      TabIndex        =   0
      Top             =   180
      Width           =   5145
      Begin VB.ComboBox cmbServer 
         Height          =   315
         Left            =   720
         TabIndex        =   5
         Top             =   990
         Width           =   3045
      End
      Begin VB.OptionButton optUseWinnt 
         BackColor       =   &H80000018&
         Caption         =   "使用Windows NT集成安全验证(&W)"
         Height          =   315
         Left            =   690
         TabIndex        =   4
         Top             =   1800
         Value           =   -1  'True
         Width           =   3075
      End
      Begin VB.OptionButton optUseUser 
         BackColor       =   &H80000018&
         Caption         =   "使用指定的用户名称和密码(&U)"
         Height          =   315
         Left            =   690
         TabIndex        =   3
         Top             =   2280
         Width           =   3015
      End
      Begin VB.TextBox txtUser 
         Height          =   285
         Left            =   1980
         TabIndex        =   2
         Top             =   2685
         Width           =   2505
      End
      Begin VB.TextBox txtPassword 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   11.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   285
         IMEMode         =   3  'DISABLE
         Left            =   1980
         PasswordChar    =   "*"
         TabIndex        =   1
         Top             =   3045
         Width           =   2505
      End
      Begin XPControls.XPCommandButton cmdRefresh 
         Height          =   285
         Left            =   3870
         TabIndex        =   6
         Top             =   990
         Width           =   645
         _ExtentX        =   1138
         _ExtentY        =   503
         Caption         =   "刷新"
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackColor       =   &H80000018&
         Caption         =   "指定下列设置以连接到SQL Server数据库:"
         Height          =   195
         Left            =   300
         TabIndex        =   11
         Top             =   300
         Width           =   3345
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackColor       =   &H80000018&
         Caption         =   "1. 选择或输入服务器名称(&E):"
         Height          =   195
         Left            =   420
         TabIndex        =   10
         Top             =   690
         Width           =   2355
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         BackColor       =   &H80000018&
         Caption         =   "2. 输入登录服务器的信息:"
         Height          =   195
         Left            =   420
         TabIndex        =   9
         Top             =   1440
         Width           =   2160
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         BackColor       =   &H80000018&
         Caption         =   "用户名称:"
         Height          =   195
         Left            =   1020
         TabIndex        =   8
         Top             =   2730
         Width           =   900
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         BackColor       =   &H80000018&
         Caption         =   "密码:"
         Height          =   195
         Left            =   1020
         TabIndex        =   7
         Top             =   3090
         Width           =   540
      End
   End
   Begin XPControls.XPCommandButton cmdCancel 
      Cancel          =   -1  'True
      Height          =   375
      Left            =   3210
      TabIndex        =   12
      Top             =   3900
      Width           =   975
      _ExtentX        =   1720
      _ExtentY        =   661
      Caption         =   "取消(&C)"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin XPControls.XPCommandButton cmdOK 
      Height          =   375
      Left            =   1620
      TabIndex        =   13
      Top             =   3900
      Width           =   975
      _ExtentX        =   1720
      _ExtentY        =   661
      Caption         =   "确定(&O)"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
End
Attribute VB_Name = "dlgServer_A"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdOK_Click()
On Error GoTo ErrMsg
    Dim Status
    Dim strSQL As String
    Dim strServer As String
    Dim blnUseWinnt As Boolean
    Dim strUser As String
    Dim strPassword As String
    
    Me.MousePointer = 11
    
    '是否选择了服务器
    If cmbServer.Text = "" Then
        MsgBox "请输入或选择服务器名称!", vbInformation, "提示"
        cmbServer.SetFocus
        GoTo ExitLab
    End If
    strServer = cmbServer.Text
    
    strSQL = "Provider=SQLOLEDB.1;Initial Catalog=master;Data Source=" & strServer
    
    '选择了哪一种验证方式
    If optUseWinnt.Value = True Then
        '采取了windows混合验证
        strSQL = strSQL & ";Integrated Security=SSPI;Persist Security Info=False"
    Else
        '采取指定用户名称和密码验证
        strSQL = strSQL & ";Persist Security Info=True;User ID=" & txtUser.Text _
                & ";Password=" & txtPassword.Text
    End If
    
On Error Resume Next
    GCon.ConnectionString = strSQL
    GCon.CursorLocation = adUseClient
    GCon.Open
    If Err.Number <> 0 Then
        Err.Clear
        MsgBox "无法连接指定的服务器!请确认是否有适当的权限,或者服务器正在运行!", vbCritical, "提示"
        GoTo ExitLab
    Else
        If AppendDatabase = True Then
            Me.MousePointer = 0
            Unload Me
        End If
    End If
    
'    '如果成功,则把配置信息写入配置文件
'    WriteINI gstrCurrPath & DSNINIFile, "Database", "Server", strServer
'    If optUseWinnt.Value = True Then
'        WriteINI gstrCurrPath & DSNINIFile, "Database", "UseWinnt", "True"
'    Else
'        WriteINI gstrCurrPath & DSNINIFile, "Database", "UseWinnt", "False"
'        WriteINI gstrCurrPath & DSNINIFile, "Database", "UID", txtUser.Text
'        WriteINI gstrCurrPath & DSNINIFile, "Database", "PWD", txtPassword.Text
'    End If
    
    GoTo ExitLab
ErrMsg:
    Status = SetError(Err.Number, Err.Description, Err.Source)
    ErrMsg Status
ExitLab:
    Me.MousePointer = 0
End Sub

Private Sub cmdRefresh_Click()
    GetLocalSQLServer cmbServer
End Sub

Private Sub Form_Load()
    optUseWinnt_Click
End Sub

Private Sub optUseWinnt_Click()
    txtUser.Enabled = False
    txtPassword.Enabled = False
    
    txtUser.BackColor = &H8000000F
    txtPassword.BackColor = &H8000000F
End Sub

Private Sub optUseUser_Click()
    txtUser.Enabled = True
    txtPassword.Enabled = True
    
    txtUser.BackColor = vbWhite
    txtPassword.BackColor = vbWhite
End Sub


⌨️ 快捷键说明

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