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

📄 frmstudent.frm

📁 学生选课系统
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form FrmStudent 
   Caption         =   "学生信息"
   ClientHeight    =   5595
   ClientLeft      =   2055
   ClientTop       =   1965
   ClientWidth     =   7470
   LinkTopic       =   "Form1"
   ScaleHeight     =   5595
   ScaleWidth      =   7470
   Begin VB.ComboBox ComSelName 
      Height          =   300
      Left            =   2880
      TabIndex        =   25
      Text            =   "请输入查询关键字"
      Top             =   4680
      Width           =   1815
   End
   Begin VB.CommandButton CmdQuit 
      Caption         =   "退出"
      Height          =   495
      Left            =   5760
      TabIndex        =   24
      Top             =   4560
      Width           =   1335
   End
   Begin VB.CommandButton CmdSelect 
      Caption         =   "查找"
      Height          =   495
      Left            =   4920
      TabIndex        =   23
      Top             =   4560
      Width           =   735
   End
   Begin VB.ComboBox ComSelType 
      Height          =   300
      ItemData        =   "FrmStudent.frx":0000
      Left            =   1200
      List            =   "FrmStudent.frx":0016
      TabIndex        =   21
      Text            =   "请选择查询类型"
      Top             =   4680
      Width           =   1695
   End
   Begin VB.CommandButton CmdDelete 
      Caption         =   "删除"
      Height          =   495
      Left            =   6000
      TabIndex        =   20
      Top             =   3480
      Width           =   1095
   End
   Begin VB.CommandButton CmdUpdate 
      Caption         =   "更新"
      Height          =   495
      Left            =   4920
      TabIndex        =   19
      Top             =   3960
      Width           =   1095
   End
   Begin VB.CommandButton CmdCancel 
      Caption         =   "取消"
      Height          =   495
      Left            =   6000
      TabIndex        =   18
      Top             =   3960
      Width           =   1095
   End
   Begin VB.CommandButton CmdAdd 
      Caption         =   "添加"
      Height          =   495
      Left            =   4920
      TabIndex        =   17
      Top             =   3480
      Width           =   1095
   End
   Begin VB.CommandButton CmdNext 
      Caption         =   "下一条"
      Height          =   495
      Left            =   2640
      TabIndex        =   16
      Top             =   3480
      Width           =   810
   End
   Begin VB.CommandButton CmdPrevious 
      Caption         =   "上一条"
      Height          =   495
      Left            =   1440
      TabIndex        =   15
      Top             =   3480
      Width           =   810
   End
   Begin VB.CommandButton CmdLast 
      Caption         =   "末一条"
      Height          =   495
      Left            =   3960
      TabIndex        =   14
      Top             =   3480
      Width           =   810
   End
   Begin VB.CommandButton CmdFirst 
      Caption         =   "第一条"
      Height          =   495
      Left            =   240
      TabIndex        =   13
      Top             =   3480
      Width           =   810
   End
   Begin MSAdodcLib.Adodc AdodcStudent 
      Height          =   330
      Left            =   360
      Top             =   3120
      Visible         =   0   'False
      Width           =   1200
      _ExtentX        =   2117
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   2
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\My Documents\student.mdb;Persist Security Info=False"
      OLEDBString     =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\My Documents\student.mdb;Persist Security Info=False"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "Student"
      Caption         =   "AdodcStudent"
      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 FraStudent 
      Caption         =   "学生基本信息"
      Height          =   2895
      Left            =   240
      TabIndex        =   0
      Top             =   120
      Width           =   6975
      Begin VB.TextBox TxtSsex 
         DataField       =   "Ssex"
         DataSource      =   "AdodcStudent"
         Height          =   375
         Left            =   1680
         TabIndex        =   12
         Top             =   1320
         Width           =   1575
      End
      Begin VB.TextBox TxtClass 
         DataField       =   "Class"
         DataSource      =   "AdodcStudent"
         Height          =   375
         Left            =   1680
         TabIndex        =   11
         Top             =   2160
         Width           =   1575
      End
      Begin VB.TextBox TxtSname 
         DataField       =   "Sname"
         DataSource      =   "AdodcStudent"
         Height          =   375
         Left            =   4920
         TabIndex        =   10
         Top             =   480
         Width           =   1575
      End
      Begin VB.TextBox TxtSbirthday 
         DataField       =   "Sbirthday"
         DataSource      =   "AdodcStudent"
         Height          =   375
         Left            =   4920
         TabIndex        =   9
         Top             =   1320
         Width           =   1575
      End
      Begin VB.TextBox TxtSdept 
         DataField       =   "Sdept"
         DataSource      =   "AdodcStudent"
         Height          =   375
         Left            =   4920
         TabIndex        =   8
         Top             =   2160
         Width           =   1575
      End
      Begin VB.TextBox TxtSno 
         DataField       =   "Sno"
         DataSource      =   "AdodcStudent"
         Height          =   375
         Left            =   1680
         TabIndex        =   1
         Top             =   480
         Width           =   1575
      End
      Begin VB.Label LabSbirthday 
         Caption         =   "出生日期:"
         Height          =   375
         Left            =   3600
         TabIndex        =   7
         Top             =   1320
         Width           =   975
      End
      Begin VB.Label LabSdept 
         Caption         =   "系别:"
         Height          =   375
         Left            =   3600
         TabIndex        =   6
         Top             =   2160
         Width           =   975
      End
      Begin VB.Label LabSsex 
         Caption         =   "性别:"
         Height          =   375
         Left            =   360
         TabIndex        =   5
         Top             =   1320
         Width           =   975
      End
      Begin VB.Label LabClass 
         Caption         =   "班级:"
         Height          =   375
         Left            =   360
         TabIndex        =   4
         Top             =   2160
         Width           =   975
      End
      Begin VB.Label LabSname 
         Caption         =   "姓名:"
         Height          =   375
         Left            =   3600
         TabIndex        =   3
         Top             =   480
         Width           =   975
      End
      Begin VB.Label LabSno 
         Caption         =   "学号:"
         Height          =   375
         Left            =   360
         TabIndex        =   2
         Top             =   480
         Width           =   975
      End
   End
   Begin VB.Label LabSelect 
      Caption         =   "查询条件:"
      Height          =   255
      Left            =   240
      TabIndex        =   22
      Top             =   4680
      Width           =   1095
   End
End
Attribute VB_Name = "FrmStudent"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub CmdAdd_Click()
    AdodcStudent.Recordset.AddNew
    TxtSno.SetFocus
    CmdAdd.Enabled = False
    CmdDelete.Enabled = False
    CmdCancel.Enabled = True
    CmdUpdate.Enabled = True
    Call EnableButton(False)
End Sub

Private Sub CmdCancel_Click()
    AdodcStudent.Recordset.CancelUpdate
    CmdAdd.Enabled = True
    CmdDelete.Enabled = True
    CmdCancel.Enabled = False
    CmdUpdate.Enabled = False
    Call EnableButton(True)
End Sub

Private Sub CmdDelete_Click()
    Dim r As Integer
    r = MsgBox("您确定要删除当前记录?", vbExclamation + vbYesNo, "信息提示")
    If r = vbYes Then
        AdodcStudent.Recordset.Delete
        AdodcStudent.Recordset.MoveNext
        If AdodcStudent.Recordset.EOF Then
            AdodcStudent.Recordset.Movelast
        End If
    End If
End Sub

Private Sub CmdFirst_Click()
    AdodcStudent.Recordset.MoveFirst
End Sub

Private Sub CmdLast_Click()
    AdodcStudent.Recordset.Movelast
End Sub

Private Sub CmdNext_Click()
    AdodcStudent.Recordset.MoveNext
    If AdodcStudent.Recordset.EOF Then AdodcStudent.Recordset.Movelast
End Sub

Private Sub CmdPrevious_Click()
    AdodcStudent.Recordset.MovePrevious
    If AdodcStudent.Recordset.BOF Then AdodcStudent.Recordset.MoveFirst
End Sub

Private Sub CmdQuit_Click()
    Unload Me
End Sub

Private Sub CmdSelect_Click()
    sterm = ComSelType.Text
    soptn = Trim(ComSelName.Text)
    FrmSselect.Show
End Sub

Private Sub CmdUpdate_Click()
    If TxtSno.Text = "" Then
        MsgBox "对不起,学号不能为空值,请您重新输入", vbExclamation, "出错信息"
        TxtSno.SetFocus
    Else
    If TxtSname.Text = "" Then
        MsgBox "对不起,姓名不能为空值,请您重新输入", vbExclamation, "出错信息"
        TxtSname.SetFocus
    Else
            AdodcStudent.Recordset("Sno") = TxtSno.Text
            AdodcStudent.Recordset("Sname") = TxtSname.Text
         If TxtSbirthday.Text <> "" Then
             AdodcStudent.Recordset("Sbirthday") = CDate(TxtSbirthday.Text)
         End If
         If TxtSsex.Text <> "" Then
            AdodcStudent.Recordset("Ssex") = TxtSsex.Text
         End If
            AdodcStudent.Recordset("Sdept") = TxtSdept.Text
            AdodcStudent.Recordset("Class") = TxtClass.Text
       
    AdodcStudent.Recordset.Update
    CmdAdd.Enabled = True
    CmdDelete.Enabled = True
    CmdUpdate.Enabled = False
    CmdCancel.Enabled = False
    Call EnableButton(True)
End If
End If
End Sub

Private Sub EnableButton(flag As Boolean)
    CmdFirst.Enabled = flag
    CmdPrevious.Enabled = flag
    CmdNext.Enabled = flag
    CmdLast.Enabled = flag
End Sub

Private Sub ComSelType_Click()
    selection = ComSelType.Text
    Select Case selection
    Case "学号"
        adoCmd.CommandText = "select sno x from stu"
    Case "姓名"
        adoCmd.CommandText = "select distinct sname x from stu"
    Case "性别"
        adoCmd.CommandText = "select distinct sex x from stu"
    Case "出生日期"
        adoCmd.CommandText = "select distinct bdate x from stu"
    Case "所在系"
        adoCmd.CommandText = "select distinct sdept x from stu"
    Case "所在班级"
        adoCmd.CommandText = "select distinct class x from stu"
    Case Else
        MsgBox "你没有选中任何条件!", vbOKOnly + vbExclamation, "警告"
    End Select
    Set adoRst = adoCmd.Execute
        ComSelName.Clear
    Do While Not adoRst.EOF
        If IsNull(adoRst!X) = False And adoRst!X <> "" Then
             ComSelName.AddItem (ConvertNull(adoRst!X))
        End If
        adoRst.MoveNext
    Loop
        adoRst.MoveFirst
    Do While IsNull(adoRst!X) = True
        adoRst.MoveNext
    Loop
        ComSelName.Text = ConvertNull(adoRst!X)
End Sub

Private Sub Form_Load()
    CmdCancel.Enabled = False
    CmdUpdate.Enabled = False
End Sub

Private Function ConvertNull(para_Value As Variant) As Variant
    If IsNull(para_Value) = True Then
         MsgBox "发现空串", vbExclamation, "信息"
    Else
        ConvertNull = CStr(para_Value)
    End If
End Function
 

⌨️ 快捷键说明

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