📄 frmgetdatabase.frm
字号:
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户密码"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 480
TabIndex = 19
Top = 2400
Width = 780
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用户名"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 195
Left = 690
TabIndex = 18
Top = 1980
Width = 585
End
End
Begin Threed.SSOption optAccess
Height = 315
Left = 3450
TabIndex = 22
Top = 300
Width = 2115
_ExtentX = 3731
_ExtentY = 556
_Version = 196610
BackStyle = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "MS Access 97/2000"
End
Begin Threed.SSOption optServer
Height = 345
Left = 510
TabIndex = 23
Top = 270
Width = 2625
_ExtentX = 4630
_ExtentY = 609
_Version = 196610
BackStyle = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "MS SQL Server 7.0/2000"
Value = -1
End
Begin Threed.SSCommand cmdAbort
Height = 375
Left = 4260
TabIndex = 24
Top = 3960
Width = 1095
_ExtentX = 1931
_ExtentY = 661
_Version = 196610
CaptionStyle = 1
BackStyle = 1
ActiveColors = -1 'True
Caption = "放弃/退出"
AutoRepeat = -1 'True
End
Begin MSComDlg.CommonDialog CD
Left = 0
Top = 4110
_ExtentX = 847
_ExtentY = 847
_Version = 393216
FileName = "JAL.MDB"
Filter = "MS Access 97/2000(*.MDB)|*.MDB"
End
Begin Threed.SSCommand cmdOK
Height = 375
Left = 2940
TabIndex = 25
Top = 3960
Width = 1095
_ExtentX = 1931
_ExtentY = 661
_Version = 196610
CaptionStyle = 1
BackStyle = 1
Windowless = -1 'True
ActiveColors = -1 'True
Caption = " 确 定 "
RoundedCorners = 0 'False
Outline = 0 'False
End
Begin VB.Line Line1
X1 = 210
X2 = 5700
Y1 = 690
Y2 = 690
End
End
End
End
Attribute VB_Name = "frmGetDataBase"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'##ModelId=3D3389F8035F
Public cnnstring As String
'##ModelId=3D3389F803E1
Private Sub cmdAbort_Click()
cnnstring = ""
Unload Me
End Sub
'##ModelId=3D3389F90022
Private Sub cmdFind_Click()
On Error Resume Next
CD.InitDir = App.Path
CD.DialogTitle = "查找数据库文件..."
CD.Filter = "MS Access 97/2000(*.MDB)|*.MDB"
CD.ShowOpen
txtAccessFile.Text = CD.FileName
If Not FileExists(CD.FileName) Then
MsgBox "文件不存在,请重新查找。", vbOKOnly, "提示"
cmdOK.Enabled = False
Else
cmdOK.Enabled = True
End If
End Sub
'##ModelId=3D3389F90054
Private Sub cmdOk_Click()
On Error Resume Next
If optServer.Value = True Then
If optSQL = True Then
cnnstring = "Provider=SQLOLEDB.1;Persist Security Info=True;User ID=" & txtServerUser.Text & ";Password=" & txtServerPassword.Text & ";Initial Catalog=" & txtDatabase.Text & ";Data Source=" & txtServerName.Text
ElseIf optNT = True Then
cnnstring = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=" & txtDatabase.Text & ";Data Source=" & txtServerName.Text
End If
ElseIf optAccess.Value = True Then
If optBlankPassword.Value = ssCBChecked Then
cnnstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & txtAccessFile.Text & ";Persist Security Info=False"
Else
cnnstring = "Provider=Microsoft.Jet.OLEDB.4.0;Password=" & txtAccessPassword.Text & ";User ID=" & txtAccessUser.Text & ";Data Source=" & txtAccessFile.Text & ";Persist Security Info=True"
Dim Path As String
Path = Left(txtAccessFile.Text, InStrRev(txtAccessFile.Text, "\"))
cnnstring = cnnstring & ";Jet OLEDB:System database=" & Path & "Secured.mdw"
End If
SaveSetting "LockDB", "CnnServer", "AccessPath", txtAccessFile.Text
Dim FileName As String
FileName = Right(txtAccessFile.Text, Len(txtAccessFile.Text) - InStrRev(txtAccessFile.Text, "\"))
SaveSetting "LockDB", "CnnServer", "FileName", FileName
End If
Unload Me
End Sub
'##ModelId=3D3389F9007C
Private Sub Form_Load()
Me.Top = (Screen.Height - Me.Height) / 2
Me.Left = (Screen.Width - Me.Width) / 2
panServer.Visible = True
panAccess.Visible = False
txtServerName.Enabled = True
txtServerPassword.Enabled = True
If Not IsNetVersion Then
optServer.Enabled = False
optAccess.Enabled = True
optAccess.Value = True
panServer.Visible = False
panAccess.Visible = True
Else
optServer.Enabled = True
optAccess.Enabled = False
optServer.Value = True
panServer.Visible = True
panAccess.Visible = False
End If
End Sub
'##ModelId=3D3389F900AE
Private Sub Form_Unload(Cancel As Integer)
Unload Me
End Sub
'##ModelId=3D3389F90126
Private Sub optAccess_Click(Value As Integer)
panServer.Visible = False
panAccess.Visible = True
End Sub
'##ModelId=3D3389F901A8
Private Sub optBlankPassword_Click(Value As Integer)
If optBlankPassword.Value = -1 Then
txtAccessPassword.Enabled = False
Else
txtAccessPassword.Enabled = True
End If
End Sub
'##ModelId=3D3389F9022A
Private Sub optNT_Click(Value As Integer)
txtServerName.Enabled = False
txtServerPassword.Enabled = False
End Sub
'##ModelId=3D3389F902B7
Private Sub optServer_Click(Value As Integer)
panServer.Visible = True
panAccess.Visible = False
End Sub
'##ModelId=3D3389F90339
Private Sub optSQL_Click(Value As Integer)
txtServerName.Enabled = True
txtServerPassword.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -