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

📄 usekc.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 usekc 
   BackColor       =   &H00FFFFFF&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "课程信息查询"
   ClientHeight    =   5985
   ClientLeft      =   45
   ClientTop       =   450
   ClientWidth     =   8325
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Picture         =   "usekc.frx":0000
   ScaleHeight     =   5985
   ScaleWidth      =   8325
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   495
      Left            =   960
      Top             =   6120
      Width           =   1200
      _ExtentX        =   2117
      _ExtentY        =   873
      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.CommandButton Command2 
      Caption         =   "关闭"
      Height          =   495
      Left            =   5640
      TabIndex        =   8
      Top             =   2400
      Width           =   1215
   End
   Begin VB.CommandButton Command5 
      Caption         =   "添加"
      Height          =   495
      Left            =   5640
      TabIndex        =   5
      Top             =   240
      Width           =   1215
   End
   Begin VB.CommandButton Command4 
      Caption         =   "保存修改"
      Height          =   495
      Left            =   5640
      TabIndex        =   6
      Top             =   960
      Width           =   1215
   End
   Begin VB.CommandButton Command3 
      Caption         =   "删除"
      Height          =   495
      Left            =   5640
      TabIndex        =   7
      Top             =   1680
      Width           =   1215
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00FFFFFF&
      Caption         =   "查询条件"
      Height          =   2535
      Left            =   120
      TabIndex        =   12
      Top             =   3120
      Width           =   7935
      Begin VB.CommandButton Command1 
         Caption         =   "查询"
         Height          =   495
         Left            =   5280
         TabIndex        =   1
         Top             =   360
         Width           =   975
      End
      Begin VB.ComboBox Combo2 
         Height          =   300
         Left            =   2640
         TabIndex        =   0
         Top             =   480
         Width           =   1695
      End
      Begin MSDataGridLib.DataGrid DataGrid1 
         Bindings        =   "usekc.frx":473B
         Height          =   1215
         Left            =   600
         TabIndex        =   14
         Top             =   1200
         Visible         =   0   'False
         Width           =   6375
         _ExtentX        =   11245
         _ExtentY        =   2143
         _Version        =   393216
         AllowUpdate     =   0   'False
         AllowArrows     =   -1  'True
         BackColor       =   16777215
         HeadLines       =   1
         RowHeight       =   15
         FormatLocked    =   -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     =   3
         BeginProperty Column00 
            DataField       =   "kch"
            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       =   "kcm"
            Caption         =   "课程名"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   2052
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "js"
            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 
               WrapText        =   -1  'True
               ColumnWidth     =   1995.024
            EndProperty
            BeginProperty Column01 
               ColumnWidth     =   1995.024
            EndProperty
            BeginProperty Column02 
               ColumnWidth     =   1995.024
            EndProperty
         EndProperty
      End
      Begin VB.Label Label4 
         BackStyle       =   0  'Transparent
         Caption         =   "课程号:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   735
         Left            =   960
         TabIndex        =   13
         Top             =   480
         Width           =   1575
      End
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      Left            =   2400
      TabIndex        =   2
      Top             =   240
      Width           =   2055
   End
   Begin VB.TextBox Text3 
      Height          =   300
      Left            =   2400
      TabIndex        =   4
      Top             =   2520
      Width           =   2055
   End
   Begin VB.TextBox Text2 
      Height          =   300
      Left            =   2400
      TabIndex        =   3
      Top             =   1380
      Width           =   2055
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   "认课教师"
      ForeColor       =   &H00FF00FF&
      Height          =   615
      Left            =   480
      TabIndex        =   11
      Top             =   2520
      Width           =   1335
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "课程名"
      ForeColor       =   &H000000FF&
      Height          =   615
      Left            =   480
      TabIndex        =   10
      Top             =   1380
      Width           =   1335
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "课程号"
      ForeColor       =   &H00FF0000&
      Height          =   615
      Left            =   480
      TabIndex        =   9
      Top             =   240
      Width           =   1335
   End
End
Attribute VB_Name = "usekc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public rs1 As New ADODB.Recordset
Public rs As New ADODB.Recordset
Private Sub Command1_Click()
Dim strsql As String
Call st1
con.Open
strsql = "select kch from kc where kch='" & Combo2.Text & "'"
Set rs1 = con.Execute(strsql)
If Combo2.Text = "" Then
    MsgBox "课程号不能为空!", vbOKOnly + vbInformation, "提示"
    Combo2.SetFocus
    con.Close
    Exit Sub
Else
   If rs1.BOF Or rs1.EOF Then
      MsgBox "没有找到符合条件的记录,请重新输入!", vbOKOnly + vbInformation, "提示"
   Else
      DataGrid1.Visible = True
      strsql = "select *from kc where kch='" & Combo2.Text & "'"
      Adodc1.ConnectionString = "Provider=SQLOLEDB;User ID=" & a & ";PWD=" & b & ";Initial Catalog=student;Data Source=" & d & ""

      Adodc1.RecordSource = strsql
      Adodc1.Refresh

      Combo1.Text = DataGrid1.Columns.Item(0)
      Text2.Text = DataGrid1.Columns.Item(1)
      Text3.Text = DataGrid1.Columns.Item(2)
   End If
End If
con.Close
End Sub
Private Sub Command2_Click()
Unload Me
frmmain.Show
End Sub

Private Sub Command3_Click()
Dim sq2 As String
Call st1
con.Open
On Error GoTo err
 If Combo1.Text = "" Then
    MsgBox "请至少输入要删除信息的课程号"
    Combo1.SetFocus
 Else
    sq2 = "delete from kc where kch='" & Combo1.Text & "'"
    con.Execute (sq2)
    MsgBox "成功删除", vbOKOnly + vbExclamation, "提示"
    Unload Me
End If
con.Close
Exit Sub
err:
MsgBox "输入错误"
con.Close
End Sub

Private Sub Command4_Click()
Dim b As String
On Error GoTo err
con.Open
b = "select kch from kc where kch='" & Combo1.Text & "'"
Set rs = con.Execute(b)
If Combo1.Text = "" Then
   MsgBox "课程号不能为空"
   Else
     If Text2.Text = "" Then
        MsgBox "课程名不能为空"
     Else
       If Text3.Text = "" Then
          MsgBox "教师不能为空"
       Else
         If rs.BOF Or rs.EOF Then
            MsgBox "该课程不存在,请重新输入!", vbOKOnly + vbInformation, "修改信息"
         Else
            b = "update kc set kcm='" & Text2.Text & "',js='" & Text3.Text & "' where kch='" & Combo1.Text & "'"
            con.Execute (b)
            MsgBox "信息修改成功!", vbOKOnly + vbInformation, "修改信息"
            Unload Me
         End If
       End If
     End If
End If
con.Close
Exit Sub
err:
MsgBox "输入错误"
con.Close
End Sub

Private Sub Command5_Click()
Dim sq As String
On Error GoTo err
con.Open
If Combo1.Text = "" Then
   MsgBox "课程号不能为空"
   Else
     If Text2.Text = "" Then
        MsgBox "课程名不能为空"
     Else
       If Text3.Text = "" Then
          MsgBox "教师不能为空"
       Else
         sq = "select kch from kc where kch='" & Combo1.Text & "'"
         Set rs1 = con.Execute(sq)
         If rs1.BOF Or rs1.EOF Then
            sq = "insert into kc(kch,kcm,js) values('" & Combo1.Text & "','" & Text2.Text & "','" & Text3.Text & "')"
            con.Execute (sq)
            MsgBox "添加成功", vbOKOnly + vbExclamation, "提示"
            Unload Me
         Else
            MsgBox "课程号不能重复插入,请重新输入!", vbOKOnly + vbInformation, "提示"
         End If
       End If
     End If
End If
con.Close
Exit Sub
err:
MsgBox "输入错误"
con.Close
End Sub

Private Sub DataGrid1_Click()
Combo1.Text = DataGrid1.Columns.Item(0)
Text2.Text = DataGrid1.Columns.Item(1)
Text3.Text = DataGrid1.Columns.Item(2)
End Sub

Private Sub Form_Load()
Call st1
End Sub

⌨️ 快捷键说明

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