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

📄 frmstudent.frm

📁 这是一个学生学籍管理系统
💻 FRM
📖 第 1 页 / 共 3 页
字号:
      Top             =   5760
      Visible         =   0   'False
      Width           =   1215
      _ExtentX        =   2143
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   2
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   3
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "DSN=eislink"
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   "eislink"
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "select * from 学生信息 "
      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.Label Label18 
      Caption         =   "性别"
      Height          =   255
      Left            =   4200
      TabIndex        =   23
      Top             =   4320
      Width           =   615
   End
   Begin VB.Label Label17 
      Caption         =   "学籍编号"
      Height          =   255
      Left            =   3360
      TabIndex        =   22
      Top             =   5760
      Width           =   855
   End
   Begin VB.Label Label15 
      Caption         =   "民族编号"
      Height          =   255
      Left            =   6000
      TabIndex        =   21
      Top             =   5040
      Width           =   975
   End
   Begin VB.Label Label13 
      Caption         =   "政治面貌编号"
      Height          =   255
      Left            =   3120
      TabIndex        =   20
      Top             =   5040
      Width           =   1335
   End
   Begin VB.Label Label6 
      Caption         =   "姓名"
      Height          =   255
      Left            =   2640
      TabIndex        =   19
      Top             =   4320
      Width           =   735
   End
   Begin VB.Label Label4 
      Caption         =   "学号"
      Height          =   255
      Left            =   0
      TabIndex        =   18
      Top             =   4320
      Width           =   855
   End
   Begin VB.Label Label8 
      Caption         =   "身份证号"
      Height          =   255
      Left            =   7320
      TabIndex        =   17
      Top             =   4320
      Width           =   975
   End
   Begin VB.Label Label9 
      Caption         =   "班级编号"
      Height          =   255
      Left            =   0
      TabIndex        =   16
      Top             =   5040
      Width           =   975
   End
   Begin VB.Label Label10 
      Caption         =   "籍贯编号"
      Height          =   255
      Left            =   0
      TabIndex        =   15
      Top             =   5760
      Width           =   855
   End
   Begin VB.Label Label12 
      Caption         =   "年级"
      Height          =   255
      Left            =   5520
      TabIndex        =   14
      Top             =   4320
      Width           =   855
   End
End
Attribute VB_Name = "frmStudent"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private bAdd As Boolean

Private Sub LoadData()
    Dim strFilter As String
    Dim db As New DataBases
    Dim rs As Recordset
    If Len(Trim(txbOne.Text)) = 0 Then
        If Len(Trim(txbTwo.Text)) = 0 Then
            If Len(Trim(txbThree.Text)) = 0 Then
                strFilter = ""
            Else
                strFilter = "where 年级 like '"
                strFilter = strFilter + Trim(txbThree.Text) + "%'"
                End If
            Else
                strFilter = "where 姓名 like '"
                strFilter = strFilter + Trim(txbTwo.Text) + "%'"
                If Len(Trim(txbThree.Text)) <> 0 Then
                strFilter = strFilter + " and 年级 like '"
                strFilter = strFilter + Trim(txbThree.Text) + "%'"
            End If
        End If
    Else
        strFilter = "where 学号 like '"
        strFilter = strFilter + Trim(txbOne.Text) + "%'"
        If Len(Trim(txbTwo.Text)) <> 0 Then
            strFilter = strFilter + " and 姓名 like '"
            strFilter = strFilter + Trim(txbTwo.Text) + "%'"
            If Len(Trim(txbThree.Text)) <> 0 Then
                strFilter = strFilter + " and 年级 like '"
                strFilter = strFilter + Trim(txbThree.Text) + "%'"
            End If
        Else
            If Len(Trim(txbThree.Text)) <> 0 Then
                strFilter = strFilter + " and 年级 like '"
                strFilter = strFilter + Trim(txbThree.Text) + "%'"
            End If
        End If
    End If
    Set rs = db.RunSelectSQLUpdatable("select * from 学生信息 " + strFilter)
    '根据查询条件重新填充DataGrid
    Set Adodc1.Recordset = rs
End Sub

Private Sub btnSearch_Click()
    LoadData
End Sub

Private Sub Form_Load()
    Dim db As New DataBases
    Adodc1.ConnectionString = db.sConn
    Adodc2.ConnectionString = db.sConn
    Adodc3.ConnectionString = db.sConn
    Adodc4.ConnectionString = db.sConn
    Adodc5.ConnectionString = db.sConn
    Adodc6.ConnectionString = db.sConn
    cbbSex.AddItem ("男")
    cbbSex.AddItem ("女")
    LoadData
    SetTextBoxState (False)
End Sub

Private Sub SetToolBarState(ByVal bState As Boolean)
    '设置Button的是否能够单击
    Toolbar1.Buttons("btnFirst").Enabled = bState
    Toolbar1.Buttons("btnBefore").Enabled = bState
    Toolbar1.Buttons("btnNext").Enabled = bState
    Toolbar1.Buttons("btnLast").Enabled = bState
    Toolbar1.Buttons("btnNew").Enabled = bState
    Toolbar1.Buttons("btnModify").Enabled = bState
    Toolbar1.Buttons("btnDelete").Enabled = bState
    Toolbar1.Buttons("btnSave").Enabled = Not bState
    Toolbar1.Buttons("btnCancel").Enabled = Not bState
    grdDataGrid.Enabled = bState
End Sub

Private Sub SetTextBoxState(ByVal bState As Boolean)
    Me.txbClassId.Enabled = bState
    Me.txbName.Enabled = bState
    Me.cbbSex.Enabled = bState
    Me.txbGrade.Enabled = bState
    Me.txbPID.Enabled = bState
    Me.cbbClassId.Enabled = bState
    Me.cbbPolity.Enabled = bState
    Me.cbbNation.Enabled = bState
    Me.cbbBirthPlace.Enabled = bState
    Me.cbbStatus.Enabled = bState
End Sub

Private Sub Clear()
    Me.txbClassId.Text = ""
    Me.txbName.Text = ""
    Me.cbbSex.Text = ""
    Me.txbGrade.Text = ""
    Me.txbPID.Text = ""
    Me.cbbClassId.Text = ""
    Me.cbbPolity.Text = ""
    Me.cbbNation.Text = ""
    Me.cbbBirthPlace.Text = ""
    Me.cbbStatus.Text = ""
End Sub

Private Sub SaveForUpdate()
    Adodc1.Recordset.UpdateBatch adAffectAll
End Sub

Private Sub DeleteData()
    Dim db As New DataBases
    Dim strSQL As String
    Dim rs As ADODB.Recordset
    strSQL = "select 编号 from 成绩表 where 学号=" + txbClassId.Text
    Set rs = db.RunSelectSQL(strSQL)
    If rs.RecordCount = 0 Then
        Adodc1.Recordset.Delete adAffectCurrent
        Adodc1.Recordset.UpdateBatch adAffectAll
    Else
        Call MsgBox("请先删除该生的其它成绩信息", vbOKOnly)
    End If
End Sub

Private Sub SaveForAdd()
    Dim db As New DataBases
    Dim strSQL As String
    strSQL = "insert into 学生信息(学号, 姓名, 班级编号, 性别, 年级, 身份证号, 政治面貌编号, 民族编号, 籍贯编号, 学籍编号) values ('"
    strSQL = strSQL + Trim(txbClassId.Text) + "','"
    strSQL = strSQL + Trim(txbName.Text) + "','"
    strSQL = strSQL + Trim(cbbClassId.Text) + "','"
    strSQL = strSQL + Trim(cbbSex.Text) + "','"
    strSQL = strSQL + Trim(txbGrade.Text) + "','"
    strSQL = strSQL + Trim(txbPID.Text) + "','"
    strSQL = strSQL + Trim(cbbPolity.Text) + "','"
    strSQL = strSQL + Trim(cbbNation.Text) + "','"
    strSQL = strSQL + Trim(cbbBirthPlace.Text) + "','"
    strSQL = strSQL + Trim(cbbStatus.Text) + "')"
    db.RunSelectSQL (strSQL)
End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
    If StrComp(Button.Key, "btnFirst") = 0 Then
        Adodc1.Recordset.MoveFirst
    ElseIf StrComp(Button.Key, "btnBefore") = 0 Then
        Adodc1.Recordset.MovePrevious
    ElseIf StrComp(Button.Key, "btnNext") = 0 Then
        Adodc1.Recordset.MoveNext
    ElseIf StrComp(Button.Key, "btnLast") = 0 Then
        Adodc1.Recordset.MoveLast
    ElseIf StrComp(Button.Key, "btnNew") = 0 Then
        bAdd = True
        Adodc1.Recordset.AddNew
        SetTextBoxState (True)
        SetToolBarState (False)
        Clear
    ElseIf StrComp(Button.Key, "btnModify") = 0 Then
        bAdd = False
        SetTextBoxState (True)
        SetToolBarState (False)
    ElseIf StrComp(Button.Key, "btnDelete") = 0 Then
        If MsgBox("确定要删除吗?", vbYesNo) = vbYes Then
            DeleteData
        End If
    ElseIf StrComp(Button.Key, "btnSave") = 0 Then
        SetTextBoxState (False)
        SetToolBarState (True)
        If bAdd = True Then
            '为新增数据保存
            SaveForAdd
            Adodc1.Recordset.CancelUpdate
            LoadData
        Else
            '为更新数据保存
            SaveForUpdate
        End If
    ElseIf StrComp(Button.Key, "btnCancel") = 0 Then
        SetTextBoxState (False)
        SetToolBarState (True)
    ElseIf StrComp(Button.Key, "btnExit") = 0 Then
        Hide
    End If
End Sub


⌨️ 快捷键说明

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