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

📄 frmzhuanye.frm

📁 学生管理信息系统
💻 FRM
📖 第 1 页 / 共 3 页
字号:
         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              =   12960
      Y1              =   600
      Y2              =   600
   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            =   5280
      TabIndex        =   0
      Top             =   120
      Width           =   2520
   End
End
Attribute VB_Name = "frmZhuanye"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private conn As ADODB.Connection
Private rsZY As ADODB.Recordset                     '专业
Private rs As ADODB.Recordset
Private rsKC As ADODB.Recordset                    '课程

Private Sub cmdZYadd_Click()
 If Trim(txtZYname.Text) = "" Or Trim(txtZYyuan.Text) = "" Then MsgBox "请输入完整的信息!", vbOKOnly + vbQuestion, "提示": Exit Sub
 Dim txtSQL As String
 txtSQL = "select * from xsZY where 专业名称='" & Trim(txtZYname.Text) & "'"
 Set rs = New ADODB.Recordset
 rs.CursorLocation = adUseClient
 rs.Open txtSQL, conn, 1, 1
 If Not rs.EOF Then
   MsgBox "数据库中已经存在该专业,请修改!", vbOKOnly + vbQuestion, "提示"
   txtZYname.Text = ""
   txtZYname.SetFocus
 Else
   rsZY.AddNew
   rsZY.Fields(0) = Trim(txtZYname.Text)
   rsZY.Fields(1) = Trim(txtZYyuan.Text)
   rsZY.Update
   DataGrid1.Refresh
   MsgBox "信息添加成功!", vbOKOnly + vbInformation, "提示"
   txtZYname.Text = "": txtZYyuan.Text = ""
 End If
End Sub

Private Sub cmdZYcha_Click()
If Trim(txtZYinfo.Text) <> "" And txtZYyuaninfo.Text <> "" Then
 If cmdZYcha.Caption = "修改" Then
  cmdZYcha.Caption = "确认修改"
  txtZYinfo.Enabled = True
  txtZYyuaninfo.Enabled = True
 Else
  cmdZYcha.Caption = "修改"
  txtZYinfo.Enabled = False
  txtZYyuaninfo.Enabled = False
  rsZY.Fields(0) = Trim(txtZYinfo.Text)
  rsZY.Fields(1) = Trim(txtZYyuaninfo.Text)
  rsZY.Update
  DataGrid1.Refresh
  MsgBox "专业信息修改成功!", vbOKOnly + vbInformation, "提示"
 End If
Else
 MsgBox "修改的信息不能为空!", vbOKOnly + vbInformation, "提示"
End If
End Sub

Private Sub cmdZYdel_Click()
On Error Resume Next
i = MsgBox("确认要删除该专业吗?", vbYesNo + vbInformation, "提示")
If i = vbYes Then
 rsZY.Delete
 rsZY.MoveFirst
End If
End Sub

Private Sub Command1_Click()
 If Trim(Text2.Text) = "" Or txtzyopt1.Text = "" Then MsgBox "请输入完整的课程信息!", vbOKOnly + vbInformation, "提示": Exit Sub
 Dim txtSQL As String
 txtSQL = "select * from xsKC where 课程名称='" & Trim(Text2.Text) & "'"
 Set rs = New ADODB.Recordset
 rs.CursorLocation = adUseClient
 rs.Open txtSQL, conn, 1, 1
 If Not rs.EOF Then
  MsgBox "数据库中已经存在该课程!", vbOKOnly + vbInformation, "提示"
  Text2.Text = ""
  Text2.SetFocus
 Else
 rsKC.AddNew
 rsKC.Fields(0) = Trim(Text2.Text)
 rsKC.Fields(1) = txtzyopt1.Text
 rsKC.Update
 DataGrid2.Refresh
 MsgBox "班级已经添加成功!", vbOKOnly + vbInformation, "提示"
 Text2.Text = "": Text2.SetFocus
 End If
End Sub
Private Sub Command2_Click()
On Error Resume Next
i = MsgBox("是否删除该班级!", vbYesNo + vbInformation, "提示")
If i = vbYes Then
rsKC.Delete
rsKC.MoveFirst
End If
End Sub

Private Sub Command3_Click()
If Trim(Text4.Text) <> "" And txtZYopt2.Text <> "" Then
 If Command3.Caption = "修改" Then
  Command3.Caption = "确认修改"
  Text4.Enabled = True
  txtZYopt2.Enabled = True
 Else
  Command3.Caption = "修改"
  Text4.Enabled = False
  txtZYopt2.Enabled = False
  rsKC.Fields(0) = Trim(Text4.Text)
  rsKC.Fields(1) = Trim(txtZYopt2.Text)
  rsKC.Update
  DataGrid2.Refresh
  MsgBox "班级信息已经修改成功!", vbOKOnly + vbInformation, "提示"
 End If
Else
 MsgBox "修改的信息不能为空", vbOKOnly + vbInformation, "提示"
End If
End Sub

Private Sub Command4_Click()
On Error Resume Next
rsZY.Close
rsKC.Close
rs.Close
Unload Me
End Sub

Private Sub Command5_Click()
If Opt1.Value And Trim(txtFindZY.Text) = "" Then MsgBox "请输入专业名称!", vbOKOnly + vbInformation, "提示": Exit Sub
If Opt2.Value And Trim(txtFindKC.Text) = "" Then MsgBox "请输入课程名称!", vbOKOnly + vbInformation, "提示": Exit Sub
Dim txtSQL As String
 If Opt1.Value Then
   txtSQL = "select * from xsZY where 专业名称='" & Trim(txtFindZY.Text) & "'"
   Set rs = New ADODB.Recordset
   rs.CursorLocation = adUseClient
   rs.Open txtSQL, conn, 1, 1
   If rs.EOF Then
     MsgBox "找不到符合条件的记录!", vbOKOnly + vbQuestion, "提示"
     txtFindZY.Text = "": txtFindZY.SetFocus
   Else
     Set DataGrid3.DataSource = rs
     DataGrid3.Refresh
     Set Text1.DataSource = rs
     Set Text3.DataSource = rs
   End If
 End If
 If Opt2.Value Then
   txtSQL = "select * from xsKC where 课程名称='" & Trim(txtFindKC.Text) & "'"
   Set rs = New ADODB.Recordset
   rs.CursorLocation = adUseClient
   rs.Open txtSQL, conn, 1, 1
   If rs.EOF Then
     MsgBox "找不到符合条件的记录!", vbOKOnly + vbQuestion, "提示"
     txtFindKC.Text = "": txtFindKC.SetFocus
   Else
     Set DataGrid4.DataSource = rs
     DataGrid4.Refresh
     Set Text5.DataSource = rs
     Set Text6.DataSource = rs
   End If
 End If
End Sub

Private Sub Command6_Click()
If Trim(Text1.Text) <> "" And Trim(Text3.Text) <> "" Then
 If Command6.Caption = "修改" Then
   Command6.Caption = "确认修改"
   Text1.Enabled = True: Text3.Enabled = True
 Else
   Command6.Caption = "修改"
   Text1.Enabled = False: Text3.Enabled = False
   rsZY.Fields(0) = Trim(Text1.Text)
   rsZY.Fields(1) = Trim(Text6.Text)
   rsZY.Update
   DataGrid3.Refresh
   DataGrid1.Refresh
   MsgBox "信息修改成功!", vbOKOnly + vbInformation, "提示"
   Command8_Click
 End If
Else
 MsgBox "信息不能为空!", vbOKOnly + vbInformation, "提示"
End If
End Sub

Private Sub Command7_Click()
On Error Resume Next
If Trim(Text5.Text) <> "" And Trim(Text6.Text) <> "" Then
 If Command7.Caption = "修改" Then
  Command7.Caption = "确认修改"
  Text5.Enabled = True: Text6.Enabled = True
 Else
  Command7.Caption = "修改"
  Text5.Enabled = False: Text6.Enabled = False
  rsKC.Fields(0) = Trim(Text5.Text)
  rsKC.Fields(1) = Trim(Text6.Text)
  rsKC.Update
  DataGrid4.Refresh
  DataGrid2.Refresh
  MsgBox "信息修改成功!", vbOKOnly + vbInformation, "提示"
  Command8_Click
 End If
Else
 MsgBox "信息不能为空!", vbOKOnly + vbInformation, "提示"
End If
End Sub

Private Sub Command8_Click()
On Error Resume Next
Set DataGrid3.DataSource = rsZY
Set DataGrid4.DataSource = rsKC
DataGrid3.Refresh
DataGrid4.Refresh
Set Text1.DataSource = rsZY
Set Text3.DataSource = rsZY
Set Text5.DataSource = rsKC
Set Text6.DataSource = rsKC
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 rsZY = New ADODB.Recordset                 '设置链接学生学籍
rsZY.CursorLocation = adUseClient
rsZY.Open "xsZY", conn, 2, 2
Set DataGrid1.DataSource = rsZY
DataGrid1.Refresh
Set txtZYinfo.DataSource = rsZY
txtZYinfo.DataField = "专业名称"
Set txtZYyuaninfo.DataSource = rsZY
txtZYyuaninfo.DataField = "所属院系"
Set txtzyopt1.RowSource = rsZY
txtzyopt1.ListField = "专业名称"
Set txtZYopt2.RowSource = rsZY
txtZYopt2.ListField = "专业名称"
Set DataGrid3.DataSource = rsZY
DataGrid3.Refresh
Set Text1.DataSource = rsZY
Text1.DataField = "专业名称"
Set Text3.DataSource = rsZY
Text3.DataField = "所属院系"

Set rsKC = New ADODB.Recordset
rsKC.CursorLocation = adUseClient
rsKC.Open "xsKC", conn, 2, 2
Set DataGrid2.DataSource = rsKC
DataGrid2.Refresh
Set Text4.DataSource = rsKC
Text4.DataField = "课程名称"
Set txtZYopt2.DataSource = rsKC
txtZYopt2.DataField = "所属专业"
Set DataGrid4.DataSource = rsKC
DataGrid4.Refresh
Set Text5.DataSource = rsKC
Text5.DataField = "课程名称"
Set Text6.DataSource = rsKC
Text6.DataField = "所属专业"
End Sub

Private Sub opt1_Click()
If Opt1.Value Then
 txtFindZY.Enabled = True
 txtFindZY.SetFocus
 txtFindKC.Text = ""
 txtFindKC.Enabled = False
End If
End Sub

Private Sub Opt2_Click()
If Opt2.Value Then
 txtFindKC.Enabled = True
 txtFindKC.SetFocus
 txtFindZY.Text = ""
 txtFindZY.Enabled = False
End If
End Sub

⌨️ 快捷键说明

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