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

📄 punishment.frm

📁 学生信息管理系统2.0,增加了数据库的恢复和备份
💻 FRM
字号:
VERSION 5.00
Object = "{CE671F01-259E-40DA-92FE-95803E2ECBB5}#1.0#0"; "SmartXPButton.ocx"
Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "MSMASK32.OCX"
Begin VB.Form punishment 
   BackColor       =   &H00E7DFE7&
   Caption         =   "处分记录"
   ClientHeight    =   3600
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   6930
   Icon            =   "punishment.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   3600
   ScaleWidth      =   6930
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   2520
      TabIndex        =   0
      Top             =   1080
      Width           =   1455
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      Left            =   5040
      Style           =   2  'Dropdown List
      TabIndex        =   1
      Top             =   1080
      Width           =   1215
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   2520
      TabIndex        =   2
      Top             =   1800
      Width           =   1455
   End
   Begin SmartXPButton.XpButton XpButton2 
      Height          =   495
      Left            =   4440
      TabIndex        =   4
      Top             =   2760
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   873
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Caption         =   "取消(&C)"
      PictureSmoothBackColor=   15460844
      ButtonPicture   =   "punishment.frx":0A02
   End
   Begin SmartXPButton.XpButton XpButton1 
      Height          =   495
      Left            =   1800
      TabIndex        =   5
      Top             =   2760
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   873
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Caption         =   "添加(&S)"
      PictureSmoothBackColor=   15460844
      ButtonPicture   =   "punishment.frx":1414
   End
   Begin MSMask.MaskEdBox txtBirth 
      BeginProperty DataFormat 
         Type            =   1
         Format          =   "yyyy-MM-dd"
         HaveTrueFalseNull=   0
         FirstDayOfWeek  =   0
         FirstWeekOfYear =   0
         LCID            =   2052
         SubFormatType   =   3
      EndProperty
      Height          =   390
      Left            =   5040
      TabIndex        =   3
      Top             =   1800
      Width           =   1455
      _ExtentX        =   2566
      _ExtentY        =   688
      _Version        =   393216
      MaxLength       =   10
      Mask            =   "####-##-##"
      PromptChar      =   "_"
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "处分记录"
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   21.75
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000002&
      Height          =   495
      Left            =   2520
      TabIndex        =   10
      Top             =   120
      Width           =   2295
   End
   Begin VB.Image Image1 
      Height          =   1740
      Left            =   360
      Picture         =   "punishment.frx":1E26
      Top             =   720
      Width           =   1380
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "学号:"
      Height          =   495
      Left            =   2040
      TabIndex        =   9
      Top             =   1200
      Width           =   495
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   "变更代码:"
      Height          =   375
      Left            =   4200
      TabIndex        =   8
      Top             =   1200
      Width           =   975
   End
   Begin VB.Label Label4 
      BackStyle       =   0  'Transparent
      Caption         =   "记录时间"
      Height          =   495
      Left            =   4200
      TabIndex        =   7
      Top             =   1920
      Width           =   735
   End
   Begin VB.Label Label5 
      BackStyle       =   0  'Transparent
      Caption         =   "描述:"
      Height          =   495
      Left            =   2040
      TabIndex        =   6
      Top             =   1920
      Width           =   495
   End
End
Attribute VB_Name = "punishment"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim myconn As New ADODB.Connection
Dim MyRs As New ADODB.Recordset
Dim str As String
Dim myrs1 As New ADODB.Recordset
Private Sub Combo1_click()
Text2.Locked = False
 str = "select * from PUNISH_LEVELS where CODE='" + Trim(Combo1.Text) + "'"
 Set myrs1 = myconn.Execute(str)
Text2.Text = Trim(myrs1.Fields("DESCRIPTION"))
Text2.Locked = True
End Sub

Private Sub Form_Load()
Set myconn = New ADODB.Connection
myconn.ConnectionString = "driver={SQL Server};" & _
      "server=(local);uid=sa;pwd=;database=student_info"
myconn.Open
'***** 使用Recordset对象的Open方法创建记录集 *****
'MyRs.Open "manager", MyConn, adOpenStatic, adLockOptimistic, adCmdTable
 Set MyRs = New ADODB.Recordset
    With MyRs
    .Source = "PUNISHMENT"
    .ActiveConnection = myconn
    .CursorType = adOpenKeyset
    .LockType = adLockOptimistic
    .Open , , , , adCmdTable
    End With
str = "select * from PUNISH_LEVELS"
Set myrs1 = myconn.Execute(str)
While Not myrs1.EOF
  Combo1.AddItem myrs1!code
  myrs1.MoveNext
Wend
txtBirth.Text = "____-__-__"
Text2.Locked = True

End Sub

Private Sub XpButton1_Click()
On Error GoTo DbnotOpen
Set myrs1 = New ADODB.Recordset
    With myrs1
    .Source = "PUNISHMENT"
    .ActiveConnection = myconn
    .CursorType = adOpenKeyset
    .LockType = adLockOptimistic
    .Open , , , , adCmdTable
    End With
If Len(Trim(Text1.Text)) <> 0 And Len(Trim(Text2.Text)) <> 0 And Len(Trim(Combo1.Text)) <> 0 And Len(Trim(txtBirth.Text)) Then
   With myrs1
    .AddNew
    .Fields("ID") = myrs1.RecordCount
    .Fields("STUDENT") = Trim(Text1.Text)
    .Fields("LEVELS") = Trim(Combo1.Text)
    .Fields("REC_TIME") = Trim(txtBirth.Text)
    .Fields("ENABLE") = "T"
    .Fields("DESCRIPTION") = Trim(Text2.Text)
    .Update
  End With
  MsgBox "学生处罚信息已添加成功!", vbOKOnly + vbInformation, "提示信息"
  Text1.Text = ""
  Text2.Text = ""
  txtBirth.Text = "____-__-__"
  Combo1.Clear
  Text1.SetFocus
Else
   MsgBox "学生处罚信息没有填写完整!", vbOKOnly + vbExclamation, "错误提示"
End If
DbnotOpen:
    If Err = -2147352571 Then
        MsgBox "生日不是有效日期,请重新输入!", vbInformation, "提示"
        txtBirth.SetFocus
        txtBirth.Text = "____-__-__"
        Exit Sub
    End If
    If Err = -2147217873 Then
        MsgBox "数据库中不存在该学号,请重新输入学号!", vbInformation, "提示"
        Text1.SetFocus
        Text1.Text = ""
        Exit Sub
    End If
    If Err = -2147217887 Then
        MsgBox " 输入的学号长度越界,请重新输入学号!", vbInformation, "提示"
        Text1.SetFocus
        Text1.Text = ""
        Exit Sub
    End If
    
End Sub

Private Sub XpButton2_Click()
MyRs.Close
myconn.Close

Unload Me

End Sub



⌨️ 快捷键说明

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