⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 对学生的信息进行系统的管理,对查询学生的信息.查询学生的成绩.统计.也有对老师的一些简单的系统管理.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form form1 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "用户登陆"
   ClientHeight    =   2475
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   3885
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2475
   ScaleWidth      =   3885
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  '窗口缺省
   Begin VB.Frame Frame1 
      Caption         =   "用户登录"
      Height          =   2295
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   3615
      Begin VB.CommandButton Command2 
         BackColor       =   &H00FF8080&
         Caption         =   "取消"
         Height          =   375
         Left            =   2040
         Style           =   1  'Graphical
         TabIndex        =   6
         Top             =   1680
         Width           =   735
      End
      Begin VB.CommandButton Command1 
         BackColor       =   &H00FF8080&
         Caption         =   "确定"
         Height          =   375
         Left            =   840
         Style           =   1  'Graphical
         TabIndex        =   5
         Top             =   1680
         Width           =   735
      End
      Begin VB.TextBox txtpassword 
         Height          =   270
         IMEMode         =   3  'DISABLE
         Left            =   1440
         PasswordChar    =   "*"
         TabIndex        =   4
         Top             =   1080
         Width           =   1575
      End
      Begin VB.TextBox txtusername 
         Height          =   270
         Left            =   1440
         TabIndex        =   3
         Top             =   480
         Width           =   1575
      End
      Begin VB.Label Label2 
         Caption         =   "密码:"
         Height          =   255
         Left            =   480
         TabIndex        =   2
         Top             =   1080
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "用户名:"
         Height          =   255
         Left            =   480
         TabIndex        =   1
         Top             =   480
         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
Dim micount As Integer             '变量定义
Dim Conn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
Public Username2 As String
Private Sub Command1_Click()
   Dim Txtsql As String
     Dim Mrc As ADODB.Recordset
     Set Cmd.ActiveConnection = Conn
     If Trim(txtusername.Text = "") Then
           MsgBox "没有这个用户,请重新输入用户名!", , "警告"
           txtusername.Text = ""
           txtusername.SetFocus
        Else
           Txtsql = "select * from 用户表 where 用户名= '" & txtusername.Text & " '"
           Cmd.CommandText = Txtsql
           Cmd.CommandType = adCmdText
           Set Mrc = Cmd.Execute
           If Mrc.EOF = True Then
               MsgBox "没有这个用户,请重新输入用户名!", , "警告"
               txtusername.Text = ""
               txtusername.SetFocus
            Else
               If Trim(Mrc.Fields(1)) = Trim(txtpassword.Text) Then
                      ok = True
                      Mrc.Close
                      Me.Hide
                      Username2 = Trim(txtusername.Text)
                      Unload Me
                      MDIForm1.Show
                      Set Mrc = Nothing
                      Set Conn = Nothing
                  Else
                      MsgBox "输入密码不正确,请重新输入!", , "警告"
                      txtpassword.Text = ""
                      txtpassword.SetFocus
                      micount = micount + 1
                         If micount = 3 Then
                            Me.Hide
                         End If
                  End If
            End If
       End If
      
   Exit Sub
End Sub

Private Sub Command2_Click()
 Set Conn = Nothing
 End
End Sub

Private Sub Form_Load()
connstr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\学生信息管理.mdb"
Conn.Open connstr
End Sub


Private Sub txtpassword_KeyPress(KeyAscii As Integer)   '获得焦点
If KeyAscii = 13 Then
    Command1.SetFocus
 End If
End Sub

Private Sub txtusername_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    txtpassword.SetFocus
 End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -