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

📄 usecourse.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 usecourse 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "成绩信息查询"
   ClientHeight    =   4455
   ClientLeft      =   45
   ClientTop       =   450
   ClientWidth     =   9375
   FillColor       =   &H000000FF&
   LinkTopic       =   "Form3"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Picture         =   "usecourse.frx":0000
   ScaleHeight     =   4455
   ScaleWidth      =   9375
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox Text4 
      Height          =   495
      Left            =   4440
      TabIndex        =   17
      Text            =   "Text4"
      Top             =   4800
      Width           =   2415
   End
   Begin VB.TextBox Text2 
      Height          =   495
      Left            =   2040
      TabIndex        =   16
      Text            =   "Text2"
      Top             =   4920
      Width           =   1815
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   495
      Left            =   480
      Top             =   4560
      Width           =   1575
      _ExtentX        =   2778
      _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.Frame Frame2 
      BackColor       =   &H00FFFFFF&
      Caption         =   "查询条件"
      Height          =   2295
      Left            =   0
      TabIndex        =   13
      Top             =   1920
      Width           =   9375
      Begin VB.TextBox CboFinNo 
         Height          =   270
         Left            =   1920
         TabIndex        =   0
         Top             =   480
         Width           =   2055
      End
      Begin VB.CommandButton Command5 
         Caption         =   "查询"
         Height          =   495
         Left            =   5160
         TabIndex        =   1
         Top             =   360
         Width           =   1215
      End
      Begin MSDataGridLib.DataGrid DataGrid1 
         Bindings        =   "usecourse.frx":35B0B
         Height          =   1080
         Left            =   600
         TabIndex        =   14
         Top             =   960
         Visible         =   0   'False
         Width           =   7935
         _ExtentX        =   13996
         _ExtentY        =   1905
         _Version        =   393216
         AllowUpdate     =   0   'False
         AllowArrows     =   -1  'True
         Enabled         =   -1  'True
         ColumnHeaders   =   -1  'True
         HeadLines       =   1
         RowHeight       =   15
         WrapCellPointer =   -1  'True
         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       =   "xh"
            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       =   "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 Column02 
            DataField       =   "fs"
            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
            BeginProperty Column02 
            EndProperty
         EndProperty
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "学生学号:"
         ForeColor       =   &H80000008&
         Height          =   180
         Left            =   480
         TabIndex        =   15
         Top             =   480
         Width           =   810
      End
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00FFFFFF&
      BorderStyle     =   0  'None
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1935
      Left            =   0
      TabIndex        =   9
      Top             =   0
      Width           =   9375
      Begin VB.CommandButton Command4 
         Caption         =   "关闭"
         Height          =   495
         Left            =   7320
         TabIndex        =   8
         Top             =   1320
         Width           =   1215
      End
      Begin VB.TextBox Text3 
         Height          =   375
         Left            =   3900
         MaxLength       =   20
         TabIndex        =   3
         Top             =   720
         Width           =   1455
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   7080
         MaxLength       =   20
         TabIndex        =   4
         Top             =   720
         Width           =   1455
      End
      Begin VB.TextBox TxtResult 
         Height          =   375
         Left            =   600
         MaxLength       =   20
         TabIndex        =   2
         Top             =   720
         Width           =   1455
      End
      Begin VB.CommandButton Command9 
         Caption         =   "添加"
         Height          =   495
         Left            =   600
         TabIndex        =   5
         Top             =   1320
         Width           =   1215
      End
      Begin VB.CommandButton Command8 
         Caption         =   "保存修改"
         Height          =   495
         Left            =   2880
         TabIndex        =   6
         Top             =   1320
         Width           =   1215
      End
      Begin VB.CommandButton Command6 
         Caption         =   "删除"
         Height          =   495
         Left            =   5160
         TabIndex        =   7
         Top             =   1320
         Width           =   1215
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "分数:"
         ForeColor       =   &H80000008&
         Height          =   180
         Left            =   7080
         TabIndex        =   12
         Top             =   240
         Width           =   900
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "课程编号:"
         ForeColor       =   &H80000008&
         Height          =   180
         Left            =   3900
         TabIndex        =   11
         Top             =   240
         Width           =   900
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "学生学号:"
         ForeColor       =   &H80000008&
         Height          =   180
         Left            =   600
         TabIndex        =   10
         Top             =   240
         Width           =   900
      End
   End
End
Attribute VB_Name = "usecourse"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public rs2 As New ADODB.Recordset
Public rs As New ADODB.Recordset
Private Sub Command4_Click()
Unload Me
frmmain.Show
End Sub
Private Sub Command5_Click()
Dim strsql As String
con.Open
strsql = "select xh from cj where xh='" & CboFinNo.Text & "'"
Set rs2 = con.Execute(strsql)
If CboFinNo.Text = "" Then
    MsgBox "学号不能为空!", vbOKOnly + vbInformation, "提示"
    CboFinNo.SetFocus
    con.Close
    Exit Sub
Else
      If rs2.BOF Or rs2.EOF Then
         MsgBox "找不到该记录!", vbOKOnly + vbInformation, "提示"
      Else
         DataGrid1.Visible = True
         strsql = "select *from  cj where xh='" & CboFinNo.Text & "'"
         Adodc1.ConnectionString = "Provider=SQLOLEDB;User ID=" & a & ";PWD=" & b & ";Initial Catalog=student;Data Source=" & d & ""

         Adodc1.RecordSource = strsql
         Adodc1.Refresh

         TxtResult.Text = DataGrid1.Columns.Item(0)
         Text3.Text = DataGrid1.Columns.Item(1)
         Text1.Text = DataGrid1.Columns.Item(2)
         Text2.Text = TxtResult.Text
         Text4.Text = Text3.Text
      End If
End If
con.Close
End Sub
Private Sub Command6_Click()
Dim sq As String
On Error GoTo err
con.Open
If TxtResult.Text = "" Then
   MsgBox "请至少输入要删除信息的学号"
Else
   sq = "delete from cj where xh='" & TxtResult.Text & "'"
   con.Execute (sq)
   MsgBox "成功删除", vbOKOnly + vbExclamation, "提示"
   Unload Me
End If
con.Close
Exit Sub
err:
MsgBox "输入错误"
con.Close
End Sub
Private Sub Command8_Click()
Dim qq As String
On Error GoTo err
con.Open
qq = "select xh from cj where xh='" & CboFinNo.Text & "'"
Set rs = con.Execute(qq)
If TxtResult.Text = "" Then
   MsgBox "学号不能为空"
Else
   If Text3.Text = "" Then
      MsgBox "课程号不能为空"
   Else
     If TxtResult.Text <> Text2.Text Or Text3.Text <> Text4.Text Then
          MsgBox "只能该动分数"
          TxtResult.Text = Text2.Text
          Text3.Text = Text4.Text
     Else
       If rs.BOF Or rs.EOF Then
        MsgBox "该记录不存在,请重新输入", vbOKOnly + vbExclamation, "提示"
       Else
          qq = "update cj set fs='" & Text1.Text & "' where xh='" & TxtResult.Text & "' and kch='" & Text3.Text & "'"
          con.Execute (qq)
          MsgBox "成功修改", vbOKOnly + vbExclamation, "提示"
          Unload Me
       End If
     End If
   End If
End If
con.Close
Exit Sub
err:
MsgBox "输入错误"
con.Close
End Sub

Private Sub Command9_Click()
Dim sq1 As String
On Error GoTo err
con.Open
sq1 = "select xh,kch from cj where xh='" & TxtResult.Text & "' and kch='" & Text3.Text & "'"
Set rs2 = con.Execute(sq1)
If TxtResult.Text = "" Then
   MsgBox "学号不能为空"
Else
   If Text3.Text = "" Then
      MsgBox "课程号不能为空"
   Else
      If rs2.BOF And rs2.EOF Then
         sq1 = "insert into cj(xh,kch,fs) values('" & TxtResult.Text & "','" & Text3.Text & "','" & Text1.Text & "')"
         con.Execute (sq1)
         MsgBox "添加成功", vbOKOnly + vbExclamation, "提示"
         Unload Me
      Else
         MsgBox "添加失败", vbOKOnly + vbExclamation, "提示"
      End If
   End If
End If
con.Close
Exit Sub
err:
MsgBox "输入错误"
con.Close
End Sub
Private Sub DataGrid1_Click()
TxtResult.Text = DataGrid1.Columns.Item(0)
Text3.Text = DataGrid1.Columns.Item(1)
Text1.Text = DataGrid1.Columns.Item(2)
End Sub
Private Sub DataGrid1_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
If Button = 2 Then
usecourse.PopupMenu FILE, 2
Else
End If
End Sub

Private Sub Form_Load()
Call st1
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If Not (Chr(KeyAscii) <= "9" And Chr(KeyAscii) >= "0" Or KeyAscii = 8 Or KeyAscii = 46) Then
    KeyAscii = 0
    MsgBox "请输入0--100的数字", vbOKOnly + vbInformation, "提示"
    Text1.Text = ""
End If
End Sub

⌨️ 快捷键说明

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