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

📄 kcsz.frm

📁 学生管理系统 很不错的一个课程设计 适合大学生毕业设计用
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form 课程设置 
   Caption         =   "基本课程设置"
   ClientHeight    =   6510
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   6540
   LinkTopic       =   "Form14"
   ScaleHeight     =   6510
   ScaleWidth      =   6540
   StartUpPosition =   3  '窗口缺省
   Begin VB.Frame Frame1 
      Caption         =   "基本课程设置"
      Height          =   6435
      Left            =   0
      TabIndex        =   0
      Top             =   30
      Width           =   6465
      Begin VB.Frame Frame3 
         Caption         =   "学分"
         Height          =   765
         Left            =   4800
         TabIndex        =   12
         Top             =   5490
         Width           =   1575
         Begin VB.TextBox Text3 
            Height          =   315
            Left            =   90
            TabIndex        =   13
            Text            =   "Text3"
            Top             =   330
            Width           =   1425
         End
      End
      Begin VB.Frame Frame2 
         Height          =   4725
         Left            =   4680
         TabIndex        =   5
         Top             =   210
         Width           =   1695
         Begin VB.CommandButton Command5 
            Caption         =   "取消"
            Height          =   375
            Left            =   480
            TabIndex        =   11
            Top             =   3840
            Width           =   855
         End
         Begin VB.CommandButton Command4 
            Caption         =   "确定"
            Height          =   375
            Left            =   480
            TabIndex        =   10
            Top             =   3030
            Width           =   855
         End
         Begin VB.CommandButton Command3 
            Caption         =   "修改"
            Height          =   375
            Left            =   480
            TabIndex        =   9
            Top             =   2235
            Width           =   855
         End
         Begin VB.CommandButton Command2 
            Caption         =   "删除"
            Height          =   375
            Left            =   480
            TabIndex        =   8
            Top             =   1425
            Width           =   855
         End
         Begin VB.CommandButton Command1 
            Caption         =   "添加"
            Height          =   375
            Left            =   480
            TabIndex        =   7
            Top             =   630
            Width           =   855
         End
      End
      Begin VB.TextBox Text2 
         Height          =   345
         Left            =   1320
         TabIndex        =   4
         Text            =   "Text2"
         Top             =   5790
         Width           =   3285
      End
      Begin VB.TextBox Text1 
         Height          =   315
         Left            =   1320
         TabIndex        =   3
         Text            =   "Text1"
         Top             =   5160
         Width           =   3285
      End
      Begin MSFlexGridLib.MSFlexGrid MSF1 
         Height          =   4695
         Left            =   90
         TabIndex        =   1
         Top             =   270
         Width           =   4515
         _ExtentX        =   7964
         _ExtentY        =   8281
         _Version        =   393216
      End
      Begin VB.Label Label3 
         Caption         =   "课程代码"
         Height          =   315
         Left            =   270
         TabIndex        =   6
         Top             =   5220
         Width           =   945
      End
      Begin VB.Label Label1 
         Caption         =   "课程名称"
         Height          =   225
         Left            =   270
         TabIndex        =   2
         Top             =   5880
         Width           =   825
      End
   End
End
Attribute VB_Name = "课程设置"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim zt As String
Dim mrc As ADODB.Recordset
Dim kcdm As String
Public Sub commok()
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
End Sub
Public Sub commnotok()
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
End Sub

Public Sub kcshowtitle()
 MSF1.Clear
  Dim i As Integer
  With MSF1
    .Cols = 4
    .TextMatrix(0, 1) = "课程代码"
    .TextMatrix(0, 2) = "课程名称"
    .TextMatrix(0, 3) = "学分"
    .ColWidth(0) = 0
    .ColWidth(1) = 400
    .ColWidth(2) = 2000
    .ColWidth(3) = 400
    .FixedRows = 1
    
    .FillStyle = flexFillSingle
    .Col = 0
    .Row = 0
    .RowSel = 1
    .ColSel = .Cols - 1
    .CellAlignment = 4
    .Row = 1
    End With
End Sub

Private Sub Command4_Click()
'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
'
'               课程添加模块代码
'
'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
If zt = "cmd1add" Then
If Text1.Text = "" Then
     sssss = MsgBox("课程代码不能为空!", vbOKOnly + vbExclamation, "警告")
     Text1.SetFocus
     Exit Sub
  End If
    If Text2.Text = "" Then
     sssss = MsgBox("课程名称不能为空!", vbOKOnly + vbExclamation, "警告")
     Text2.SetFocus
     Exit Sub
  End If
  If Text3.Text = "" Then
     sssss = MsgBox("学分不能为空!", vbOKOnly + vbExclamation, "警告")
     Text3.SetFocus
     Exit Sub
  End If
txtsql = "select * from 课程 where 课程代码='" & Trim(Text1.Text) & "'"
Set mrc = ExecuteSQL(txtsql)
 ' mrc.Refresh
  If mrc.EOF = False Then
   sssss = MsgBox("已经存在该课程代码!", vbOKOnly + vbExclamation, "警告")
    Text1.SetFocus
     Text1.SelStart = 0
     Text1.SelLength = Len(Text1.Text)
    Exit Sub
   Else
  mrc.AddNew
  mrc.Fields(0) = Text1.Text
  mrc.Fields(1) = Text2.Text
  mrc.Fields(2) = Str$(Text3.Text)
  mrc.Update
  MsgBox "课程添加成功!", vbOKOnly + vbExclamation, "警告"
 Text1.Text = ""
 Text2.Text = ""
 Text3.Text = ""
 Me.commok
 kcshowtitle
 kcshowdata
 
 End If
 End If
 '***************************************************
 '
 '           院系修改模块代码
 '
 '***********************************************
 If zt = "cmd3edit" Then
 txtsql = "select * from 课程 where 课程代码='" & Trim(Text1.Text) & "'"
 Set mrc = ExecuteSQL(txtsql)
 If mrc.Fields(1) = Trim(Text2.Text) Then
 MsgBox "必须输入改变值!", vbOKOnly + vbExclamation, "警告"
 Text2.SetFocus
 Exit Sub
 Else
  mrc.Fields(0) = Text1.Text
  mrc.Fields(1) = Text2.Text
  mrc.Fields(2) = Val(Text3.Text)
  mrc.Update
  MsgBox "院系修改成功!", vbOKOnly + vbExclamation, "警告"
 Text1.Text = ""
 Text2.Text = ""
 Text3.Text = ""
Me.commok
 kcshowtitle
 kcshowdata
 End If
 End If
 Command4.Enabled = False
 zt = ""
End Sub

Private Sub Command5_Click()
Unload Me
End Sub

Private Sub Command1_Click()
zt = "cmd1add"
Text1.Enabled = True
Text1.SetFocus
  Text1.Text = ""
  Text2.Text = ""
  Text3.Text = ""
  Command2.Enabled = False
  Command3.Enabled = False
  Command4.Enabled = True
  End Sub

Private Sub Command2_Click()
'zt = "cmd2del"
If Trim(Me.MSF1.TextMatrix(MSF1.Row, 1)) = "" Then
   sssss = MsgBox("你还没有选择记录!", vbOKOnly + vbExclamation, "警告")
Else
  If MsgBox("确定要删除 课程名称 为 " & Trim(Me.MSF1.TextMatrix(MSF1.Row, 2)) & " 的记录吗?", vbOKCancel + vbExclamation, "警告") = vbOK Then
  txtsql = "select * from 课程 where 课程代码='" & Trim(Me.MSF1.TextMatrix(MSF1.Row, 1)) & "'"
  Set mrc = ExecuteSQL(txtsql)
  kcdm = Trim(Me.MSF1.TextMatrix(MSF1.Row, 1))
  'mrc.Refresh
  mrc.Delete
  mrc.Close
  '删除学生选课表中的属于该课程代码的记录
  txtsql = "select * from 学生选课 where 课程号='" & Trim(kcdm) & "'"
  Set mrc = ExecuteSQL(txtsql)
  If Not mrc.EOF Then
  mrc.Delete
  End If
  mrc.Close
  '删除学生成绩表中的属于该课程的记录
  txtsql = "select * from 学生成绩 where 课程号='" & Trim(kcdm) & "'"
  Set mrc = ExecuteSQL(txtsql)
  If Not mrc.EOF Then
  mrc.Delete
  End If
  mrc.Close
  '*************************************
  MsgBox "课程删除成功!", vbOKOnly + vbExclamation, "警告"
  Text1.Text = ""
   Text2.Text = ""
   Text3.Text = ""
  kcshowtitle
  kcshowdata
  End If
End If
End Sub

Private Sub Command3_Click()
zt = "cmd3edit"
If Trim(Me.MSF1.TextMatrix(MSF1.Row, 1)) = "" Then
   sssss = MsgBox("你还没有选择记录!", vbOKOnly + vbExclamation, "警告")
   Command2.Enabled = True
   Command1.Enabled = True
   'Text1.Enabled = False
   Text2.Enabled = False
   Command3.Enabled = True
   
Else
   Text1.Enabled = False
   Text2.Enabled = True
   Text3.Enabled = True
   Text2.SetFocus
   Command2.Enabled = False
   Command1.Enabled = False
   Command3.Enabled = False
End If

End Sub

Private Sub Form_Load()
Text1.Enabled = False
Me.commok
Command4.Enabled = False
'adodc1.ConnectionString = connstring
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
'txtsql = "select * from 课程"
Me.kcshowtitle
Me.kcshowdata
'kcshowtitle
'kcshowdata
End Sub

Public Sub kcshowdata()
Dim j As Integer
Dim i As Integer

'Dim mrc As adodb.Recordset
txtsql = "select * from 课程"
Set mrc = ExecuteSQL(txtsql)
'mrc.Refresh
 If mrc.EOF = False Then
   mrc.MoveFirst
   With MSF1
   .Rows = 15
     .Row = 2
   
    Do While Not mrc.EOF
     .Rows = .Rows + 1
     For i = 1 To mrc.Fields.Count
      .TextMatrix(.Row - 1, i) = mrc.Fields(i - 1)
     Next i
     .Row = .Row + 1
     mrc.MoveNext
    Loop
 End With
End If
End Sub

Private Sub MSF1_Click()
'Dim mrc As adodb.Recordset
If Trim(Me.MSF1.TextMatrix(MSF1.Row, 1)) = "" Then
   Text1.Text = ""
   Text2.Text = ""
Else
  txtsql = "select * from 课程 where 课程代码='" & Trim(Me.MSF1.TextMatrix(MSF1.Row, 1)) & "'"
  Set mrc = ExecuteSQL(txtsql)
  'mrc.Refresh
   Text1.Text = mrc.Fields(0)
   Text2.Text = mrc.Fields(1)
   Text3.Text = Str$(mrc.Fields(2))
End If
Me.commok
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
  Text2.SetFocus
End If
End Sub


⌨️ 快捷键说明

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