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

📄 frmstsi.frm

📁 学生信息管理系统的设计,包含与数据库的通信接口和密码等.
💻 FRM
📖 第 1 页 / 共 3 页
字号:
      Height          =   255
      Index           =   4
      Left            =   4320
      TabIndex        =   24
      Top             =   600
      Visible         =   0   'False
      Width           =   855
   End
   Begin VB.Label Label2 
      Caption         =   "在此输入出生日期"
      Height          =   255
      Index           =   3
      Left            =   3240
      TabIndex        =   23
      Top             =   600
      Visible         =   0   'False
      Width           =   855
   End
   Begin VB.Label Label2 
      Caption         =   "在此选择学生性别"
      Height          =   255
      Index           =   2
      Left            =   2280
      TabIndex        =   22
      Top             =   600
      Visible         =   0   'False
      Width           =   855
   End
   Begin VB.Label Label2 
      Caption         =   "在此输入学生姓名"
      Height          =   255
      Index           =   1
      Left            =   1200
      TabIndex        =   21
      Top             =   600
      Visible         =   0   'False
      Width           =   855
   End
   Begin VB.Label Label2 
      Caption         =   "在此输入学生学号"
      Height          =   255
      Index           =   0
      Left            =   120
      TabIndex        =   20
      Top             =   600
      Visible         =   0   'False
      Width           =   855
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "  删  除"
      ForeColor       =   &H80000008&
      Height          =   375
      Index           =   3
      Left            =   3720
      TabIndex        =   13
      Top             =   0
      Width           =   1215
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "  修  改"
      ForeColor       =   &H80000008&
      Height          =   375
      Index           =   2
      Left            =   2520
      TabIndex        =   12
      Top             =   0
      Width           =   1215
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "  查  询"
      ForeColor       =   &H80000008&
      Height          =   375
      Index           =   1
      Left            =   1320
      TabIndex        =   11
      Top             =   0
      Width           =   1215
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      BackColor       =   &H00E0E0E0&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "  添  加"
      ForeColor       =   &H80000008&
      Height          =   375
      Index           =   0
      Left            =   120
      TabIndex        =   10
      Top             =   0
      Width           =   1215
   End
End
Attribute VB_Name = "frmstsi"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mrc As ADODB.Recordset
Dim MsgText As String
Dim tSQL As String
Private Sub Combo1_Click()
    Text1(4) = Combo1.Text
    If Label1(3).BackColor <> &HFFFFFF Then
        If Label2(4).Caption = Combo1.Text Then
            Combo1.BackColor = &HE0E0E0
        Else
            Combo1.BackColor = &HFFFFFF
        End If
    End If
End Sub

Private Sub Command1_Click()
    Dim txtSQL As String
    For i = 0 To 7
        If i <> 4 Then
            If Text1(i) = Label2(i).Caption Then
                MsgBox "请" & Label2(i).Caption & "!", vbOKOnly, "提示"
                Text1(i).SetFocus
                Exit Sub
            End If
        Else
            If Text1(i) = Label2(i).Caption Then
                MsgBox "请" & Label2(i).Caption & "!", vbOKOnly, "提示"
                Combo1.SetFocus
                Exit Sub
            End If
        End If
    Next
    If IsDate(Text1(3)) = False Then
        MsgBox "出生日期应为日期格式(yyyy-mm-dd)!", vbOKOnly, "警告"
        Text1(3).SetFocus
        Exit Sub
    End If
    If IsDate(Text1(6)) = False Then
        MsgBox "入学日期应为日期格式(yyyy-mm-dd)!", vbOKOnly, "警告"
        Text1(6).SetFocus
        Exit Sub
    End If
    txtSQL = "select * from student_Form where student_NO='" & Trim(Text1(0)) & "'"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    If mrc.EOF = False Then
        MsgBox "学号不能重复!", vbOKOnly, "警告"
        Text1(0).SetFocus
        Exit Sub
    End If
    mrc.Close
    txtSQL = "select * from student_Form"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    mrc.AddNew
    mrc.Fields(0) = Trim(Text1(0))
    mrc.Fields(1) = Trim(Text1(1))
    mrc.Fields(2) = Trim(Text1(2))
    mrc.Fields(3) = Trim(Text1(3))
    mrc.Fields(4) = Trim(Text1(4))
    mrc.Fields(5) = Trim(Text1(5))
    mrc.Fields(6) = Trim(Text1(6))
    mrc.Fields(7) = Trim(Text1(7))
    If Text1(8) = Label2(8).Caption Then
        mrc.Fields(8) = ""
    Else
        mrc.Fields(8) = Trim(Text1(8))
    End If
    mrc.Update
    mrc.Close
    MsgBox "学籍信息添加成功!", vbOKOnly, "提示"
    With MSFlexGrid1
        .Rows = .Rows + 1
        .TextMatrix(.Rows - 1, 0) = Trim(Text1(0))
        .TextMatrix(.Rows - 1, 1) = Trim(Text1(1))
        .TextMatrix(.Rows - 1, 2) = Trim(Text1(2))
        .TextMatrix(.Rows - 1, 3) = Trim(Text1(3))
        .TextMatrix(.Rows - 1, 4) = Trim(Text1(4))
        .TextMatrix(.Rows - 1, 5) = Trim(Text1(5))
        .TextMatrix(.Rows - 1, 6) = Trim(Text1(6))
        .TextMatrix(.Rows - 1, 7) = Trim(Text1(7))
        If Text1(8) <> Label2(8).Caption Then
            .TextMatrix(.Rows - 1, 8) = Trim(Text1(8))
        End If
    End With
    MSFlexGrid1.TopRow = MSFlexGrid1.Rows - 1
    TextDcolor
End Sub

Private Sub Command2_Click()
    Dim j As Integer
    Dim txtSQL As String
    If Text1(5) <> Label2(5).Caption Then
        If IsDate(Text1(5)) = False Then
            MsgBox "起始日期应为日期格式(yyyy-mm-dd)!", vbOKOnly, "警告"
            Text1(5).SetFocus
            Exit Sub
        Else
            Text1(5) = Format(Text1(5), "yyyy-mm-dd")
        End If
    End If
    If Text1(6) <> Label2(6).Caption Then
        If IsDate(Text1(6)) = False Then
            MsgBox "起始日期应为日期格式(yyyy-mm-dd)!", vbOKOnly, "警告"
            Text1(6).SetFocus
            Exit Sub
        Else
            Text1(6) = Format(Text1(6), "yyyy-mm-dd")
        End If
    End If
    txtSQL = "select * from student_Form"
    If Text1(0) <> Label2(0).Caption Then
        txtSQL = txtSQL & " where student_NO='" & Trim(Text1(0)) & "'"
    End If
    If Text1(1) <> Label2(1).Caption Then
        If txtSQL = "select * from student_Form" Then
            txtSQL = txtSQL & " where student_Name='" & Trim(Text1(1)) & "'"
        Else
            txtSQL = txtSQL & " and student_Name='" & Trim(Text1(1)) & "'"
        End If
    End If
    If Text1(4) <> Label2(4).Caption Then
        If txtSQL = "select * from student_Form" Then
            txtSQL = txtSQL & " where student_Cla='" & Trim(Text1(4)) & "'"
        Else
            txtSQL = txtSQL & " and student_Cla='" & Trim(Text1(4)) & "'"
        End If
    End If
    If Text1(5) <> Label2(5).Caption And Text1(6) <> Label2(6).Caption Then
        If txtSQL = "select * from student_Form" Then
            txtSQL = txtSQL & " where Format(student_Esd,'yyyy-mm-dd') >='" & Trim(Text1(5)) & "'and Format(student_Esd,'yyyy-mm-dd') <='" & Trim(Text1(6)) & "'"
        Else
            txtSQL = txtSQL & " and Format(student_Esd,'yyyy-mm-dd') >='" & Trim(Text1(5)) & "'and Format(student_Esd,'yyyy-mm-dd') <='" & Trim(Text1(6)) & "'"
        End If
    End If
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    j = 1
    Do While Not mrc.EOF
        j = j + 1
    mrc.MoveNext
    Loop
    ProgressBar1.Visible = True
    ProgressBar1.Min = CInt(0)
    ProgressBar1.Max = CInt(j)
    Set mrc = ExecuteSQL(txtSQL, MsgText)
        Frame1.Visible = True
        With MSFlexGrid1
        .Visible = False
        .Rows = 1
        ProgressBar1.Value = .Rows
        Do While Not mrc.EOF
            .Rows = .Rows + 1
            For i = 0 To mrc.Fields.Count - 1
                Select Case mrc.Fields(i).Type
                    Case adDBDate
                        .TextMatrix(.Rows - 1, i) = Format(mrc.Fields(i) & "", "yyyy-mm-dd")
                    Case Else
                        .TextMatrix(.Rows - 1, i) = mrc.Fields(i) & ""
                End Select
            Next i
            mrc.MoveNext
        Loop
        .Visible = True
        End With
        Frame1.Visible = False
    mrc.Close
    TextDcolor
    Text1(4).Visible = True
    Combo1.Visible = False
    Text1(2).Enabled = False
    Text1(3).Enabled = False
    Text1(7).Enabled = False
    Text1(8).Enabled = False
End Sub

Private Sub Command3_Click()
    Dim txtSQL As String
    Dim j As Integer
    For i = 0 To 7
        If i <> 4 Then
            If Text1(i) = Label2(i).Caption Then
                MsgBox "请" & Label2(i).Caption & "!", vbOKOnly, "提示"
                Text1(i).SetFocus
                Exit Sub
            End If
        Else
            If Text1(i) = Label2(i).Caption Then
                MsgBox "请" & Label2(i).Caption & "!", vbOKOnly, "提示"
                Combo1.SetFocus
                Exit Sub
            End If
        End If
    Next
    If IsDate(Text1(3)) = False Then
        MsgBox "出生日期应为日期格式(yyyy-mm-dd)!", vbOKOnly, "警告"
        Text1(3).SetFocus
        Exit Sub
    End If
    If IsDate(Text1(6)) = False Then
        MsgBox "入学日期应为日期格式(yyyy-mm-dd)!", vbOKOnly, "警告"
        Text1(6).SetFocus
        Exit Sub
    End If
    txtSQL = "delete from student_Form where student_NO='" & Trim(Text1(0)) & "'"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
   
    txtSQL = "select * from student_Form"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    mrc.AddNew
    mrc.Fields(0) = Trim(Text1(0))
    mrc.Fields(1) = Trim(Text1(1))
    mrc.Fields(2) = Trim(Text1(2))
    mrc.Fields(3) = Trim(Text1(3))
    mrc.Fields(4) = Trim(Text1(4))
    mrc.Fields(5) = Trim(Text1(5))
    mrc.Fields(6) = Trim(Text1(6))
    mrc.Fields(7) = Trim(Text1(7))
    If Text1(8) = Label2(8).Caption Then
        mrc.Fields(8) = ""
    Else
        mrc.Fields(8) = Trim(Text1(8))
    End If
    mrc.Update
    mrc.Close
    MsgBox "学籍信息修改成功!", vbOKOnly, "提示"
    j = 0
    For i = 1 To MSFlexGrid1.Rows - 1
        If MSFlexGrid1.TextMatrix(i, 0) = Text1(0) Then
            j = i
        End If
    Next
    If j <> 0 Then
        MSFlexGrid1.TextMatrix(j, 0) = Trim(Text1(0))

⌨️ 快捷键说明

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