📄 login.frm
字号:
VERSION 5.00
Begin VB.Form LoginDb
Caption = "连接数据库"
ClientHeight = 2640
ClientLeft = 60
ClientTop = 345
ClientWidth = 3735
LinkTopic = "Form1"
ScaleHeight = 2640
ScaleWidth = 3735
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "取消"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2160
TabIndex = 9
Top = 2160
Width = 1100
End
Begin VB.CommandButton Command1
Caption = "确认连接"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 8
Top = 2160
Width = 1100
End
Begin VB.TextBox Text4
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
IMEMode = 3 'DISABLE
Left = 1680
PasswordChar = "*"
TabIndex = 7
Text = "sa"
Top = 1680
Width = 1800
End
Begin VB.TextBox Text3
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1680
TabIndex = 6
Text = "sa"
Top = 1200
Width = 1800
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1680
TabIndex = 5
Text = "Sstudent"
Top = 720
Width = 1800
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1680
TabIndex = 4
Top = 240
Width = 1800
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "SQL 用户密码:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 240
TabIndex = 3
Top = 1680
Width = 1470
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "SQL用户:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 720
TabIndex = 2
Top = 1200
Width = 945
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "数据库名称:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 480
TabIndex = 1
Top = 840
Width = 1260
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "登录服务器名:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 240
TabIndex = 0
Top = 360
Width = 1470
End
End
Attribute VB_Name = "LoginDb"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rstu As Recordset
Private Sub Command1_Click()
On Error GoTo err
If (Text1.Text <> "") And (Text2.Text <> "") Then
LoginSQLServer Text1.Text, Text2.Text, Text3.Text, Text4.Text
MsgBox "连接数据库成功!", vbInformation, "连接"
Unload Me
Else
MsgBox "请输入服务器主机名!", vbInformation, "连接"
End If
Exit Sub
err:
MsgBox "数据库连接失败!!", vbInformation, "连接"
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
LoginSQLServer
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Command1.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -