📄 load1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3330
ClientLeft = 60
ClientTop = 450
ClientWidth = 5385
LinkTopic = "Form1"
ScaleHeight = 3330
ScaleWidth = 5385
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Caption = "登录信息"
Height = 4335
Left = 240
TabIndex = 0
Top = 120
Width = 5535
Begin VB.CommandButton Command8
Caption = "退出"
Height = 375
Left = 3000
TabIndex = 7
Top = 1800
Width = 735
End
Begin VB.TextBox Text1
Height = 375
Left = 1800
TabIndex = 4
Top = 480
Width = 1455
End
Begin VB.TextBox Text2
Height = 375
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 3
Top = 1200
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "登录"
Height = 375
Left = 1800
TabIndex = 2
Top = 1800
Width = 975
End
Begin VB.CommandButton Command2
Caption = "修改密码"
Height = 375
Left = 480
TabIndex = 1
Top = 1800
Width = 975
End
Begin VB.Label Label1
Caption = "用户名:"
Height = 255
Left = 600
TabIndex = 6
Top = 480
Width = 735
End
Begin VB.Label Label2
Caption = "密 码:"
Height = 255
Left = 600
TabIndex = 5
Top = 1320
Width = 855
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Dim Rs1 As New ADODB.Recordset
Dim chaxun1 As String
Set Rs1 = New Recordset
chaxun1 = " select * from 用户 where 用户名= '" & Text1.Text & "' and 密码='" & Text2.Text & "'"
Rs1.Open chaxun1, Str, adOpenKeyset, adLockOptimistic, adCmdText
On Error GoTo li2
If Rs1(3) = "管理员" Then
Unload Form1
Form8.Show
ElseIf Rs1(3) = "医生用户" Then
Unload Form1
Form9.Show
ElseIf Rs1(3) = "计费员" Then
Unload Form1
Form6.Show
Else: GoTo li2
End If
GoTo li1
li2: MsgBox "用户名或用户密码错误"
li1:
End Sub
Private Sub Command2_Click()
Dim Rs1 As New ADODB.Recordset
Dim chaxun1 As String
Set Rs1 = New Recordset
chaxun1 = " select * from 用户 where 用户名= '" & Text1.Text & "' and 密码='" & Text2.Text & "'"
Rs1.Open chaxun1, Str, adOpenKeyset, adLockOptimistic, adCmdText
If Rs1.RecordCount > 0 Then
username = Text1.Text
password = Text2.Text
Unload Form1
Form7.Show
Else:
GoTo li2
End If
GoTo li1
Rs1.MoveFirst
li2: MsgBox "用户名或用户密码错误"
li1:
End Sub
Private Sub Command8_Click()
If MsgBox("确实要退出吗?", vbOKCancel + vbQuestion, "系统退出") = vbOK Then
Unload Me
Else
Exit Sub
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -