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

📄 form6.frm

📁 对学生的信息进行系统的管理,对查询学生的信息.查询学生的成绩.统计.也有对老师的一些简单的系统管理.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form6 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "课程信息修改"
   ClientHeight    =   3780
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   4905
   LinkTopic       =   "Form6"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3780
   ScaleWidth      =   4905
   ShowInTaskbar   =   0   'False
   Begin VB.Frame Frame2 
      Caption         =   "课程修改"
      Height          =   2295
      Left            =   120
      TabIndex        =   3
      Top             =   1440
      Width           =   4695
      Begin VB.TextBox Text3 
         Height          =   270
         Left            =   1440
         TabIndex        =   10
         Top             =   1200
         Width           =   1695
      End
      Begin VB.TextBox Text2 
         Height          =   270
         Left            =   1440
         TabIndex        =   9
         Top             =   600
         Width           =   1695
      End
      Begin VB.CommandButton Command4 
         BackColor       =   &H00FF8080&
         Caption         =   "退出"
         Height          =   375
         Left            =   3600
         Style           =   1  'Graphical
         TabIndex        =   8
         Top             =   1800
         Width           =   735
      End
      Begin VB.CommandButton Command3 
         BackColor       =   &H00FF8080&
         Caption         =   "保存"
         Height          =   375
         Left            =   1200
         Style           =   1  'Graphical
         TabIndex        =   7
         Top             =   1800
         Width           =   735
      End
      Begin VB.CommandButton Command2 
         BackColor       =   &H00FF8080&
         Caption         =   "修改"
         Height          =   375
         Left            =   360
         Style           =   1  'Graphical
         TabIndex        =   6
         Top             =   1800
         Width           =   735
      End
      Begin VB.Label Label2 
         Caption         =   "课程名称:"
         Height          =   255
         Left            =   360
         TabIndex        =   5
         Top             =   1200
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "课程编号:"
         Height          =   255
         Left            =   360
         TabIndex        =   4
         Top             =   600
         Width           =   975
      End
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H00FF8080&
      Caption         =   "确定"
      Height          =   400
      Left            =   3720
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   720
      Width           =   795
   End
   Begin VB.TextBox Text1 
      Height          =   400
      Left            =   1080
      TabIndex        =   1
      Top             =   720
      Width           =   1995
   End
   Begin VB.Frame Frame1 
      Caption         =   "输入课程名称"
      Height          =   1215
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   4695
   End
End
Attribute VB_Name = "Form6"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Conn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
'在课程编号和课程名的文本框中显示数据库中的数据
Sub Showtext()
Text2.Text = Rs("课程编号")
Text3.Text = Rs("课程名称")
End Sub

Private Sub Command1_Click()
Dim Txtsql As String

 Dim Txtsql2 As String
   Dim Mrc As ADODB.Recordset
  '检查输入学号是否在数据库中有同名记录
   If Trim(Text1.Text) = "" Then
      MsgBox "请输入课程名称!", vbExclamation, "出错啦!"
      Exit Sub
    Else
      Txtsql2 = "select * from 课程表"
      Set Mrc = ExecuteSQL(Txtsql2)
      While (Mrc.EOF = False)
          If Trim(Mrc("课程名称")) = Trim(Text1.Text) Then
                 GoTo Wangjun
             Else
                  Mrc.MoveNext
          End If
      Wend
      MsgBox "这个课程名称不存在,请重新输入!", , "出错啦!"
      Text1.Text = ""
      Exit Sub
   End If


Wangjun:
Txtsql = "select * from 课程表 where "
Txtsql = Txtsql & "课程名称= '" & Trim(Text1.Text) & "'"

Set Rs = ExecuteSQL(Txtsql)
Call Showtext
End Sub

Private Sub Command2_Click()
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = True
End Sub

Private Sub Command3_Click()
Rs("课程编号") = Text2.Text
Rs("课程名称") = Text3.Text
Rs.Update
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text2.Enabled = False
Text3.Enabled = False
Text1.Text = ""
Command1.Enabled = False
Command2.Enabled = True
Command3.Enabled = False
End Sub

Private Sub Command4_Click()
Unload Me
Conn.Close
End Sub

Private Sub Form_Load()
connstr = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\学生信息管理.mdb"
Conn.Open connstr
'Rs.Open "课程表", Conn, adOpenKeyset, adLockPessimistic
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Command1.Enabled = False
Command3.Enabled = False
End Sub

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

⌨️ 快捷键说明

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