📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "登陆"
ClientHeight = 6255
ClientLeft = 60
ClientTop = 450
ClientWidth = 7800
LinkTopic = "Form1"
ScaleHeight = 6255
ScaleWidth = 7800
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "取消"
Height = 735
Left = 4080
TabIndex = 3
Top = 4440
Width = 1575
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 735
Left = 1320
TabIndex = 2
Top = 4440
Width = 1455
End
Begin VB.TextBox Text2
Height = 495
IMEMode = 3 'DISABLE
Left = 2520
PasswordChar = "*"
TabIndex = 1
Top = 3000
Width = 2655
End
Begin VB.TextBox Text1
Height = 495
Left = 2520
TabIndex = 0
Top = 1920
Width = 2655
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "密 码:"
BeginProperty Font
Name = "黑体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 1440
TabIndex = 6
Top = 3120
Width = 975
End
Begin VB.Label Label2
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "用户名:"
BeginProperty Font
Name = "黑体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1320
TabIndex = 5
Top = 2040
Width = 1215
End
Begin VB.Label Label1
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "用 户 管 理 系 统"
BeginProperty Font
Name = "黑体"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1215
Left = 1680
TabIndex = 4
Top = 600
Width = 4095
End
Begin VB.Image Image1
Height = 6255
Left = -120
Picture = "Form1.frx":0000
Stretch = -1 'True
Top = 0
Width = 7935
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim micount As Integer
Public use As String
Public Function executesql(ByVal sql As String) As ADODB.Recordset
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Set cnn = New ADODB.Connection
Dim stokens() As String
stokens = Split(sql)
cnn.Open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\student.mdb"
If InStr(" INSERT,DELETE,UPDATE", UCase$(stokens(0))) Then
cnn.Execute sql
Else
Set rst = New ADODB.Recordset
rst.Open Trim$(sql), cnn, adOpenKeyset, adLockOptimistic
Set executesql = rst
End If
End Function
Private Sub Command1_Click()
Dim txtsql As String
Dim mrc As ADODB.Recordset
If Trim(Text1.Text = " ") Then
MsgBox "没有这个用户,请从新输入用户名!", , "警告"
Else
txtsql = "select * from 用户表 where 用户表.用户名= " & "'" & Trim(Text1.Text) & "'"
Set mrc = executesql(txtsql)
If mrc.EOF = True Then
MsgBox "没有这个用户,请从新输入用户名!", , "警告"
Else
If Trim(mrc.Fields(1)) = Trim(Text2.Text) Then
use = Trim(mrc.Fields(0).Value)
mrc.Close
Me.Hide
MDIForm1.Show
Else
MsgBox "没有这个用户,请从新输入用户名!", , "警告"
Text2.Text = ""
End If
End If
End If
micount = micount + 1
If micount = 3 Then
Me.Hide
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
connstr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\student.mdb"
conn.Open connstr
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -