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

📄 frmsc.frm

📁 学生管理系统 对课程进行管理
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmsc 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "删除用户"
   ClientHeight    =   3015
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4710
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3015
   ScaleWidth      =   4710
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   375
      Left            =   2760
      TabIndex        =   5
      Top             =   2280
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   375
      Left            =   1080
      TabIndex        =   4
      Top             =   2280
      Width           =   855
   End
   Begin VB.TextBox Text2 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   2280
      MaxLength       =   20
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   1320
      Width           =   2055
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   2280
      MaxLength       =   20
      TabIndex        =   1
      Top             =   480
      Width           =   2055
   End
   Begin VB.Label Label2 
      Caption         =   "密码:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   480
      TabIndex        =   2
      Top             =   1320
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "用户名:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   480
      TabIndex        =   0
      Top             =   480
      Width           =   1215
   End
End
Attribute VB_Name = "frmsc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
 '声明变量
Dim cnn As New ADODB.Connection
Dim ret As New ADODB.Recordset
Dim local_db As String
Dim username As String
Dim password As String
username = Trim(Text1.Text)
password = Text2.Text
'检查文本框是否为空
If username = "" Then
MsgBox "请输入用户名", , "警告"
Text1.SetFocus
Else
If password = "" Then
MsgBox "请输入密码", , "警告"
Text2.SetFocus
End If
End If
'检查用户是否存在
If username <> "" And password <> "" Then
Set cnn = New ADODB.Connection
Set ret = New ADODB.Recordset
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path & "\data\db.mdb" + ";Persist Security Info=False;" '连接数据库
local_db = "select 用户名 from 用户表" + _
" where 用户表.用户名=" + "'" + username + "'"
ret.Open local_db, cnn
If ret.BOF And ret.EOF Then
MsgBox "系统中无此用户", , "警告"
Text1.Text = "" '初始化文本框
Text2.Text = ""
Text1.SetFocus '设置光标焦点
ret.Close
'检查密码是否正确
Else
ret.Close
local_db = "select 用户名 from 用户表" + _
" where 用户表.用户名=" + "'" + username + "' and" + _
" 用户表.密码=" + "'" + password + "'"
ret.Open local_db, cnn
If ret.BOF And ret.EOF Then
MsgBox "密码错误", , "警告"
ret.Close
Else
'禁止删除admin
If username = "admin" Then
MsgBox "不能删除admin", , "警告"
Text1.Text = "" '初始化文本框
Text2.Text = ""
Text1.SetFocus '设置光标焦点
Else
'删除用户
ret.Close
ts1.Show
Beep
frmsc.Enabled = False
mainfrm.Enabled = False
End If
End If
End If
End If
End Sub

Private Sub Command2_Click()
frmsc.Hide
Text1.Text = "" '初始化文本框
Text2.Text = ""
'初始化主窗口
mainfrm.guanli.Enabled = True
mainfrm.chaxun.Enabled = True
mainfrm.tongji.Enabled = True
If userid = "admin" Then
mainfrm.xitong.Enabled = True
mainfrm.bdb.Enabled = True
Else
mainfrm.xitong.Enabled = False
mainfrm.bdb.Enabled = False
End If
mainfrm.Command1.Enabled = True
mainfrm.Command2.Enabled = True
mainfrm.Command3.Enabled = True
If userid = "admin" Then
mainfrm.Command4.Enabled = True
Else
mainfrm.Command4.Enabled = False
End If
GetStatus "<就绪>"
End Sub

⌨️ 快捷键说明

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