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

📄 formcoursequery.frm

📁 数据库课程设计开发
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form frmcoursequery 
   Caption         =   "课程查询"
   ClientHeight    =   5520
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   7395
   LinkTopic       =   "Form1"
   ScaleHeight     =   5520
   ScaleWidth      =   7395
   StartUpPosition =   3  '窗口缺省
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   120
      Top             =   5040
      Visible         =   0   'False
      Width           =   2895
      _ExtentX        =   5106
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.ComboBox cmbCourse 
      Height          =   300
      Left            =   360
      Style           =   2  'Dropdown List
      TabIndex        =   13
      Top             =   240
      Width           =   1815
   End
   Begin VB.CommandButton cmdQuit 
      Cancel          =   -1  'True
      Caption         =   "退出(&Q)"
      Height          =   375
      Left            =   600
      TabIndex        =   11
      Top             =   960
      Width           =   975
   End
   Begin VB.Frame fmCourse 
      Caption         =   "课程信息"
      Height          =   1455
      Left            =   2280
      TabIndex        =   0
      Top             =   0
      Width           =   4815
      Begin VB.Label lblPeriod 
         BackColor       =   &H8000000E&
         Caption         =   "学时数"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   255
         Left            =   3690
         TabIndex        =   10
         Top             =   720
         Width           =   930
      End
      Begin VB.Label lblCredit 
         BackColor       =   &H8000000E&
         Caption         =   "学分"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   255
         Left            =   3690
         TabIndex        =   9
         Top             =   360
         Width           =   930
      End
      Begin VB.Label lblCourseName 
         BackColor       =   &H8000000E&
         Caption         =   "课程名称"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   255
         Left            =   930
         TabIndex        =   8
         Top             =   720
         Width           =   1770
      End
      Begin VB.Label lblCourseID 
         BackColor       =   &H8000000E&
         Caption         =   "课程编号"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   255
         Left            =   930
         TabIndex        =   7
         Top             =   360
         Width           =   1770
      End
      Begin VB.Label lblTeacher 
         BackColor       =   &H8000000E&
         Caption         =   "任课老师"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H8000000D&
         Height          =   255
         Left            =   930
         TabIndex        =   6
         Top             =   1080
         Width           =   1770
      End
      Begin VB.Label Label15 
         Alignment       =   1  'Right Justify
         Caption         =   "学时数"
         Height          =   255
         Left            =   2760
         TabIndex        =   5
         Top             =   720
         Width           =   855
      End
      Begin VB.Label Label14 
         Alignment       =   1  'Right Justify
         Caption         =   "学分"
         Height          =   255
         Left            =   2760
         TabIndex        =   4
         Top             =   360
         Width           =   855
      End
      Begin VB.Label Label13 
         Alignment       =   1  'Right Justify
         Caption         =   "课程名称"
         Height          =   255
         Left            =   30
         TabIndex        =   3
         Top             =   720
         Width           =   855
      End
      Begin VB.Label Label12 
         Alignment       =   1  'Right Justify
         Caption         =   "课程编号"
         Height          =   255
         Left            =   30
         TabIndex        =   2
         Top             =   360
         Width           =   855
      End
      Begin VB.Label Label11 
         Alignment       =   1  'Right Justify
         Caption         =   "任课老师"
         Height          =   255
         Left            =   30
         TabIndex        =   1
         Top             =   1080
         Width           =   855
      End
   End
   Begin MSDataGridLib.DataGrid dgCourseSelect 
      Height          =   3375
      Left            =   0
      TabIndex        =   12
      Top             =   1560
      Width           =   7095
      _ExtentX        =   12515
      _ExtentY        =   5953
      _Version        =   393216
      AllowUpdate     =   -1  'True
      HeadLines       =   1
      RowHeight       =   15
      AllowAddNew     =   -1  'True
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         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
   Begin VB.Label Label2 
      Caption         =   "课程编号"
      Height          =   300
      Left            =   0
      TabIndex        =   14
      Top             =   0
      Width           =   840
   End
End
Attribute VB_Name = "frmcoursequery"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmbCourse_Click()
CourseInfo
  FullGrid

End Sub

Private Sub cmdquit_Click()
Unload Me
End Sub

Private Sub Form_Load()
  Adodc1.ConnectionString = "Provider=Microsoft.Jet.oledb.4.0;Data Source=" & App.Path & "\CourseMIS.mdb;Persist Security Info=False"
  Adodc1.RecordSource = "SELECT * FROM Course"
  Adodc1.Refresh
  FullCourse
  cmbCourse_Click
  
End Sub
Private Sub FullCourse()
  cmbCourse.Clear
  While Not Adodc1.Recordset.EOF
    cmbCourse.AddItem Adodc1.Recordset("CourseID").Value
    Adodc1.Recordset.MoveNext
  Wend
  If cmbCourse.ListCount > 0 Then cmbCourse.ListIndex = 0
  End Sub
Private Sub CourseInfo()
 If cmbCourse.ListIndex < 0 Then Exit Sub
  
  Adodc1.RecordSource = "SELECT * FROM Course WHERE CourseID='" & cmbCourse.Text & "';"
  Adodc1.Refresh
  If Not Adodc1.Recordset.EOF Then
    lblCourseID = Adodc1.Recordset("CourseID").Value
    lblCourseName = Adodc1.Recordset("CourseName").Value
    lblCredit = Str(Adodc1.Recordset("Credit").Value)
    lblPeriod = Str(Adodc1.Recordset("Period").Value)
    lblTeacher = Adodc1.Recordset("Teacher").Value
  Else
    lblCourseID = ""
    lblCourseName = ""
    lblCredit = ""
    lblPeriod = ""
    lblTeacher = ""
  End If
  Adodc1.Recordset.Close
End Sub
Private Sub FullGrid()
  If Adodc1.Recordset.State <> adStateClosed Then Adodc1.Recordset.Close
  
  strSQL = "SELECT ClassName, ClassRoom, ClassDate"
  strSQL = strSQL & " FROM  CourseSelect, Class "
  strSQL = strSQL & " WHERE Class.ClassID = CourseSelect.ClassID"
  strSQL = strSQL & " AND CourseSelect.CourseID='" & cmbCourse.Text & "'"
  Adodc1.RecordSource = strSQL
  Adodc1.Refresh
  
  Set dgCourseSelect.DataSource = Adodc1.Recordset
  With dgCourseSelect
    .Columns(0).Width = 2100
    .Columns(0).Caption = "班级名称"
    .Columns(1).Width = 1200
    .Columns(1).Caption = "上课地点"
    .Columns(2).Width = 1200
    .Columns(2).Caption = "上课时间"
  End With
End Sub

Private Sub Form_Unload(Cancel As Integer)
Set dgCourseSelect.DataSource = Nothing
End Sub

⌨️ 快捷键说明

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