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

📄 frmsta_edit.frm

📁 一个学生信息管理系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   240
         TabIndex        =   3
         Top             =   360
         Width           =   735
      End
   End
   Begin VB.Frame Frame2 
      Caption         =   "查看"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   975
      Left            =   480
      TabIndex        =   17
      Top             =   4680
      Width           =   3975
   End
   Begin VB.Frame Frame3 
      Caption         =   "历史记录"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   3495
      Left            =   4200
      TabIndex        =   19
      Top             =   120
      Width           =   5415
   End
   Begin VB.Label Label4 
      BackStyle       =   0  'Transparent
      Caption         =   "当前日期"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   360
      TabIndex        =   7
      Top             =   2040
      Width           =   975
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   "当前时段"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   360
      TabIndex        =   6
      Top             =   2760
      Width           =   975
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "姓名"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   840
      TabIndex        =   1
      Top             =   1320
      Width           =   495
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "学号"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   840
      TabIndex        =   0
      Top             =   600
      Width           =   495
   End
End
Attribute VB_Name = "frmsta_edit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mrc As ADODB.Recordset
Dim mrcc As ADODB.Recordset
Dim myBookmark As Variant
Dim mcclean As Boolean

Private Sub Command1_Click()
    If Command1.Caption = "添加" Then
       mcclean = False
       Command1.Caption = "保存"
       Call cleartext
       Call enabletext
       Command2.Enabled = False
       Command3.Enabled = False
       Command4.Enabled = False
       Command5.Enabled = False
    Else
       Command1.Caption = "添加"
              
      Dim txtSQL As String
      Dim MsgText As String
   
'判断是否输入学号
      If Not Testtxt(Text1.Text) Then
          MsgBox "请输入学号!", vbOKOnly + vbExclamation, "警告!"
          Text1.SetFocus
          Exit Sub
      End If
      txtSQL = "select * from status"
      Set mrc = ExecuteSQL(txtSQL, MsgText)
      mrc.AddNew
      mrc.Fields(0) = Trim(Text1.Text)
      mrc.Fields(1) = Trim(Text2.Text)
      Text2.Text = Date
      mrc.Fields(5) = Text2.Text
      mrc.Fields(2) = Trim(Combo1.Text)
      mrc.Update
      MsgBox "状态添加成功!", vbOKOnly + vbExclamation, "信息"
      Call viewData
       Command2.Enabled = True
       Command3.Enabled = True
       Command4.Enabled = True
       Command5.Enabled = True
   End If
End Sub

Private Sub Command2_Click()
    mrc.MoveFirst
    Call viewData
End Sub

Private Sub Command3_Click()
    mrc.MoveLast
    Call viewData
End Sub

Private Sub Command4_Click()
    mrc.MovePrevious
    If mrc.BOF Then
        mrc.MoveLast
    End If
    Call viewData
End Sub

Private Sub Command5_Click()
    mrc.MoveNext
    If mrc.EOF Then
    mrc.MoveFirst
    End If
    Call viewData
End Sub

Private Sub Command6_Click()
    Unload Me
End Sub

Private Sub Command7_Click()
  Dim txtSQL As String
  Dim MsgText As String
    
        If Trim(Text4.Text) = "" Then
            sMeg = "学号不能为空"
            MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
            Text4.SetFocus
            Exit Sub
        Else
            If Not IsNumeric(Trim(Text4.Text)) Then
                MsgBox "请输入数字!", vbOKOnly + vbExclamation, "警告"
                Exit Sub
                Text4.SetFocus
            End If
        End If

    
    
    txtSQL = "select * from status where number=" & Trim(Text4.Text) & ""
    Set mrcc = ExecuteSQL(txtSQL, MsgText)
    
    With Grid1
        .Rows = 2
        .CellAlignment = 4
        .TextMatrix(0, 0) = "学号"
        .TextMatrix(0, 1) = "姓名"
        .TextMatrix(0, 2) = "课程时间"
        .TextMatrix(0, 3) = "日期"
        .TextMatrix(0, 4) = "状态"
        
        Do While Not mrcc.EOF
           
            .CellAlignment = 4
            .TextMatrix(.Rows - 1, 0) = mrcc.Fields(0)
            .TextMatrix(.Rows - 1, 1) = mrcc.Fields(1)
            .TextMatrix(.Rows - 1, 2) = mrcc.Fields(2)
            .TextMatrix(.Rows - 1, 3) = Format(mrcc.Fields(5), "yyyy-mm-dd")
            .TextMatrix(.Rows - 1, 4) = mrcc.Fields(3)
            .Rows = .Rows + 1
            mrcc.MoveNext
        Loop
       
    End With
    
    mrc.Close
End Sub

Private Sub Form_Load()
    Dim txtSQL As String
    Dim MsgText As String
    
    txtSQL = "select * from status "
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    mrc.MoveFirst
    Call viewData
    mcclean = True
    
    Combo1.AddItem "上午一二节"
    Combo1.AddItem "上午三四节"
    Combo1.AddItem "下午五六节"
    
    With Grid1
        .CellAlignment = 4
        .TextMatrix(0, 0) = "学号"
        .TextMatrix(0, 1) = "姓名"
        .TextMatrix(0, 2) = "课程时间"
        .TextMatrix(0, 3) = "日期"
        .TextMatrix(0, 4) = "状态"
    End With
    
    
End Sub

Public Sub viewData()
    Text1.Text = mrc.Fields(0)
    Text2.Text = mrc.Fields(1)
    Text3.Text = mrc.Fields(5)
    Combo1.Text = mrc.Fields(2)
    If Trim$(mrc.Fields(3)) = "事假" Then
       Option1.Value = True
       Option2.Value = False
       Option3.Value = False
       Option4.Value = False
    End If
    If Trim$(mrc.Fields(3)) = "病假" Then
       Option1.Value = False
       Option2.Value = True
       Option3.Value = False
       Option4.Value = False
    End If
    If Trim$(mrc.Fields(3)) = "旷课" Then
       Option1.Value = False
       Option2.Value = False
       Option3.Value = True
       Option4.Value = False
    End If
    If Trim$(mrc.Fields(3)) = "正常" Then
       Option1.Value = False
       Option2.Value = False
       Option3.Value = False
       Option4.Value = True
    End If
    
End Sub

Public Sub cleartext()
     Text1.Text = ""
     Text2.Text = ""
     Text3.Text = ""
     Combo1.Text = ""
     Option1.Value = False
     Option2.Value = False
     Option3.Value = False
     Option4.Value = False
End Sub
Public Sub enabletext()
     Text1.Enabled = True
     Text2.Enabled = True
     Text3.Enabled = True
     Combo1.Enabled = True
     Option1.Enabled = True
     Option2.Enabled = True
     Option3.Enabled = True
     Option4.Enabled = True
End Sub

⌨️ 快捷键说明

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