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

📄 frmscore.frm

📁 学生管理信息系统
💻 FRM
📖 第 1 页 / 共 3 页
字号:
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   2
         BeginProperty Column00 
            DataField       =   ""
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   ""
            Caption         =   ""
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            BeginProperty Column00 
            EndProperty
            BeginProperty Column01 
            EndProperty
         EndProperty
      End
   End
   Begin VB.Line Line1 
      X1              =   0
      X2              =   11760
      Y1              =   720
      Y2              =   720
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      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       =   &H000000FF&
      Height          =   435
      Left            =   4320
      TabIndex        =   0
      Top             =   120
      Width           =   2520
   End
End
Attribute VB_Name = "frmScore"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private conn As ADODB.Connection
Private rsScore As ADODB.Recordset
Private rsZY As ADODB.Recordset
Private rsKC As ADODB.Recordset
Private rs As ADODB.Recordset
Private rsBJ As ADODB.Recordset
Private rsXJ As ADODB.Recordset
Private Sub cmdADDscore_Click()
If Trim(Text1.Text) = "" Or Trim(Text2.Text) = "" Or Trim(Text7.Text) = "" Or DataCombo1.Text = "" Or DataCombo2.Text = "" Then
 MsgBox "请输入完整的信息!", vbOKOnly + vbInformation, "提示"
 Exit Sub
End If
If Not IsNumeric(Text7.Text) Then
 MsgBox "成绩要输入数据型数据! ", vbOKOnly + vbInformation, "提示"
 Text7.Text = ""
 Text7.SetFocus
 Exit Sub
End If
If Val(Text7.Text) > 100 Then
 MsgBox "成绩的最大值不能超过100分,重新输入!", vbOKOnly + vbInformation, "提示"
 Text7.Text = ""
 Text7.SetFocus
 Exit Sub
End If
Dim txtSQL As String
txtSQL = "select * from xsXJ where 学号='" & Trim(Text1.Text) & "'" & " and 姓名='" & Trim(Text2.Text) & "'"
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open txtSQL, conn, 1, 1
If rs.EOF Then
  MsgBox "数据库中没有该学号或该姓名的学生!请检查输入!", vbOKOnly + vbInformation, "提示"
  Text1.Text = ""
  Text1.SetFocus
Else
 ' txtSQL = "select * from xsScore where 课程='" & DataCombo2.Text & "'"
 ' Set rsScore = New ADODB.Recordset
 ' rsScore.CursorLocation = adUseClient
 ' rsScore.Open txtSQL, conn, 1, 1
 ' If Not rsScore.EOF Then
 '   MsgBox "该课程已经添加过成绩,只能修改不能添加了!", vbOKOnly + vbInformation, "提示": Exit Sub
 ' End If
  rsScore.AddNew
  rsScore.Fields(0) = Trim(Text1.Text)
  rsScore.Fields(1) = Trim(Text2.Text)
  rsScore.Fields(2) = DataCombo1.Text
  rsScore.Fields(3) = DataCombo2.Text
  rsScore.Fields(4) = Trim(Text7.Text) + "分"
  rsScore.Update
  DataGrid1.Refresh
End If
End Sub

Private Sub Command1_Click()
rs.Close
rsKC.Close
rsXJ.Close
rsScore.Close
rsZY.Close
rsBJ.Close
Unload Me
End Sub

Private Sub Command2_Click()
If Option4.Value And Trim(Text3.Text) = "" Then MsgBox "请输入学号!", vbOKOnly + vbInformation, "提示": Exit Sub
If Option5.Value And Trim(Text4.Text) = "" Then MsgBox "请输入姓名!", vbOKOnly + vbInformation, "提示": Exit Sub
Dim txtSQL As String
 If Option4.Value Then
   txtSQL = "select * from xsScore where 学号='" & Trim(Text3.Text) & "'"
 Else
   txtSQL = "select * from xsScore where 姓名='" & Trim(Text4.Text) & "'"
 End If
 Set rs = New ADODB.Recordset
 rs.CursorLocation = adUseClient
 rs.Open txtSQL, conn, 1, 1
 If rs.EOF Then
   MsgBox "没有找到符合条件的记录!", vbOKOnly + vbInformation, "提示"
 Else
   Set DataGrid2.DataSource = rs
   For i = 0 To 3
     Set txtS(i).DataSource = rs
   Next
   Set DataCombo8.DataSource = rs
   DataGrid2.Refresh
 
 End If
End Sub

Private Sub Command3_Click()
If Command3.Caption = "修改" Then
  Command3.Caption = "确认修改"
   DataCombo8.Enabled = True
   txtS(3).Enabled = True
Else
  Command3.Caption = "修改"
   DataCombo8.Enabled = False
   txtS(3).Enabled = False
  inputChange                             '成绩修改模块
End If
End Sub

Private Sub Command6_Click()
 rsScore.MovePrevious
If rsScore.BOF Then
  MsgBox "已经首记录了!", vbOKOnly + vbInformation, "提示"
  rsScore.MoveFirst
End If
End Sub

Private Sub Command7_Click()
rsScore.MoveNext
If rsScore.EOF Then
  MsgBox "已经是末记录了!", vbOKOnly + vbInformation, "提示"
  rsScore.MoveLast
End If
End Sub

Private Sub Command8_Click()
Set DataGrid2.DataSource = rsScore
DataGrid2.Refresh
'For i = 0 To 3
'  txtS(i).DataSource = rsScore
'Next
End Sub

Private Sub Form_Activate()
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\xs.mdb"
conn.Open
Set rsScore = New ADODB.Recordset
rsScore.CursorLocation = adUseClient
rsScore.Open "xsScore", conn, 2, 2
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open "xsScore", conn, 1, 1
Set rsZY = New ADODB.Recordset
rsZY.CursorLocation = adUseClient
rsZY.Open "xsZY", conn, 1, 1
Set rsKC = New ADODB.Recordset
rsKC.CursorLocation = adUseClient
rsKC.Open "xsKC", conn, 1, 1
Set rsBJ = New ADODB.Recordset
rsBJ.CursorLocation = adUseClient
rsBJ.Open "xsBJ", conn, 1, 1

Set rsXJ = New ADODB.Recordset
rsXJ.CursorLocation = adUseClient
rsXJ.Open "xsXJ", conn, 1, 1

Set DataCombo1.RowSource = rsZY
DataCombo1.ListField = "专业名称"
Set DataCombo2.RowSource = rsKC
DataCombo2.ListField = "课程名称"

Set DataGrid1.DataSource = rsScore
Set DataGrid2.DataSource = rsScore
Set DataGrid3.DataSource = rsScore
For i = 0 To 3
  Set txtS(i).DataSource = rsScore
Next
 Set DataCombo8.DataSource = rsScore
 txtS(0).DataField = "学号"
 txtS(1).DataField = "姓名"
 txtS(2).DataField = "专业"
 txtS(3).DataField = "成绩"
 DataCombo8.DataField = "课程名"

 Set DataCombo3.RowSource = rsZY
 Set DataCombo4.RowSource = rsBJ
 Set DataCombo6.RowSource = rsZY
 Set DataCombo5.RowSource = rsBJ
 Set DataCombo7.RowSource = rsKC
 DataCombo3.ListField = "专业名称"
 DataCombo4.ListField = "班级名称"
 DataCombo5.ListField = "班级名称"
 DataCombo6.ListField = "专业名称"
 DataCombo7.ListField = "课程名称"
End Sub

Sub inputChange()              '成绩修改模块
  For i = 0 To 3
   If Trim(txtS(i).Text) = "" Then
     MsgBox "成绩记录不能为空!", vbOKOnly + vbInformation, "提示"
     Exit Sub
   End If
  Next
'   If DataCombo8.Text = "" Then
'    MsgBox "请选择课程!", vbOKOnly + vbInformation, "提示"
'    Exit Sub
'   End If
 rsScore.Fields(3) = DataCombo8.Text
 rsScore.Fields(4) = Trim(txtS(3).Text)
 rsScore.Update
 DataGrid2.Refresh
 MsgBox "成绩修改成功!", vbOKOnly + vbInformation, "提示"
 
End Sub

Private Sub Option1_Click()
If Option1.Value Then
  DataCombo3.Enabled = True
  DataCombo4.Enabled = True
  Check1.Value = 0: Check2.Value = 0
  Frame5.Enabled = True
End If
End Sub

Private Sub Option2_Click()
If Option2.Value Then
 DataCombo3.Enabled = False
 DataCombo4.Enabled = False
 Frame5.Enabled = False
End If
End Sub

Private Sub Option3_Click()
If Option3.Value Then
  Frame5.Enabled = True
  DataCombo3.Enabled = False
  DataCombo4.Enabled = False
  Check1.Value = 0: Check2.Value = 0
End If
End Sub

Private Sub Option4_Click()
Text4.Enabled = False
Text4.Text = ""
Text3.Enabled = True
Text3.SetFocus
End Sub

Private Sub Option5_Click()
Text3.Enabled = False
Text3.Text = ""
Text4.Enabled = True
Text4.SetFocus
End Sub

⌨️ 快捷键说明

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