📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 4 'Fixed ToolWindow
Caption = "登录"
ClientHeight = 4125
ClientLeft = 45
ClientTop = 390
ClientWidth = 5850
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4125
ScaleWidth = 5850
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "取消"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3240
TabIndex = 6
Top = 2640
Width = 855
End
Begin VB.CommandButton Command1
Caption = "确定"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1560
TabIndex = 5
Top = 2640
Width = 975
End
Begin VB.TextBox Text2
Height = 495
IMEMode = 3 'DISABLE
Left = 2400
PasswordChar = "*"
TabIndex = 4
Top = 1800
Width = 1575
End
Begin VB.TextBox Text1
Height = 495
Left = 2400
TabIndex = 3
Top = 1080
Width = 1575
End
Begin VB.Label Label3
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 = 960
OLEDropMode = 1 'Manual
TabIndex = 2
Top = 1800
Width = 1215
End
Begin VB.Label Label2
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 = 255
Left = 1200
TabIndex = 1
Top = 1080
Width = 975
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "学生信息管理系统"
BeginProperty Font
Name = "黑体"
Size = 24
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 960
TabIndex = 0
Top = 240
Width = 4215
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 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 name As String
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
name = 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()
Me.Hide
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 + -