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

📄 frmaddsinfo.frm

📁 本系统是个学生信息管理系统,能够完成对学生的日常管理功能
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmAddsinfo 
   Caption         =   "添加学籍信息"
   ClientHeight    =   5340
   ClientLeft      =   48
   ClientTop       =   348
   ClientWidth     =   8616
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   10.8
      Charset         =   0
      Weight          =   700
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   5340
   ScaleWidth      =   8616
   Begin VB.CommandButton Command2 
      Caption         =   "取消添加"
      Height          =   372
      Left            =   4320
      TabIndex        =   19
      Top             =   4560
      Width           =   1092
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定添加"
      Height          =   372
      Left            =   2160
      TabIndex        =   18
      Top             =   4560
      Width           =   1092
   End
   Begin VB.TextBox txtComment 
      Height          =   1572
      Left            =   1560
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   17
      Top             =   2640
      Width           =   2532
   End
   Begin VB.TextBox txtAddress 
      Height          =   852
      Left            =   6000
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   16
      Top             =   2160
      Width           =   2172
   End
   Begin VB.TextBox txtRudate 
      Height          =   372
      Left            =   1560
      TabIndex        =   15
      Top             =   2040
      Width           =   1692
   End
   Begin VB.TextBox txtTel 
      Height          =   372
      Left            =   6000
      TabIndex        =   14
      Top             =   1560
      Width           =   1692
   End
   Begin VB.ComboBox comboClassNo 
      Height          =   312
      ItemData        =   "frmAddsinfo.frx":0000
      Left            =   1560
      List            =   "frmAddsinfo.frx":0002
      TabIndex        =   13
      Top             =   1560
      Width           =   1692
   End
   Begin VB.TextBox txtBorndate 
      Height          =   372
      Left            =   6000
      TabIndex        =   12
      Top             =   960
      Width           =   1692
   End
   Begin VB.TextBox txtName 
      Height          =   372
      Left            =   6000
      TabIndex        =   11
      Top             =   360
      Width           =   1692
   End
   Begin VB.ComboBox comboSex 
      Height          =   312
      ItemData        =   "frmAddsinfo.frx":0004
      Left            =   1560
      List            =   "frmAddsinfo.frx":0006
      TabIndex        =   10
      Top             =   960
      Width           =   612
   End
   Begin VB.TextBox txtSID 
      Height          =   372
      Left            =   1560
      TabIndex        =   1
      Top             =   360
      Width           =   1692
   End
   Begin VB.Label Label9 
      Alignment       =   2  'Center
      Caption         =   "备注"
      Height          =   372
      Left            =   240
      TabIndex        =   9
      Top             =   2760
      Width           =   1092
   End
   Begin VB.Label Label8 
      Alignment       =   2  'Center
      Caption         =   "家庭住址"
      Height          =   252
      Left            =   4680
      TabIndex        =   8
      Top             =   2160
      Width           =   1092
   End
   Begin VB.Label Label7 
      Alignment       =   2  'Center
      Caption         =   "入校日期"
      Height          =   252
      Left            =   240
      TabIndex        =   7
      Top             =   2160
      Width           =   1092
   End
   Begin VB.Label Label6 
      Alignment       =   2  'Center
      Caption         =   "联系电话"
      Height          =   372
      Left            =   4680
      TabIndex        =   6
      Top             =   1560
      Width           =   1092
   End
   Begin VB.Label Label5 
      Alignment       =   2  'Center
      Caption         =   "班号"
      Height          =   252
      Left            =   240
      TabIndex        =   5
      Top             =   1560
      Width           =   1092
   End
   Begin VB.Label Label4 
      Alignment       =   2  'Center
      Caption         =   "出生日期"
      Height          =   252
      Left            =   4680
      TabIndex        =   4
      Top             =   1080
      Width           =   1092
   End
   Begin VB.Label Label3 
      Alignment       =   2  'Center
      Caption         =   "性别"
      Height          =   252
      Left            =   240
      TabIndex        =   3
      Top             =   960
      Width           =   1092
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      Caption         =   "姓名"
      Height          =   252
      Left            =   4680
      TabIndex        =   2
      Top             =   480
      Width           =   1092
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Caption         =   "学号"
      Height          =   252
      Left            =   240
      TabIndex        =   0
      Top             =   360
      Width           =   1092
   End
End
Attribute VB_Name = "frmAddsinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Command1_Click()
    Dim mrc As ADODB.Recordset
    Dim txtSQL As String
    Dim MsgText As String
    
    If Not Testtxt(txtSID.Text) Then
        MsgBox "请输入学号!", vbOKOnly + vbExclamation, "警告"
        txtSID.SetFocus
        Exit Sub
    End If
    
    If Not Testtxt(txtName.Text) Then
        MsgBox "请输入姓名!", vbOKOnly + vbExclamation, "警告"
        txtName.SetFocus
        Exit Sub
    End If
    
    If Not Testtxt(comboSex.Text) Then
        MsgBox "请选择性别!", vbOKOnly + vbExclamation, "警告"
        comboSex.SetFocus
        Exit Sub
    End If
    
    If Not Testtxt(txtBorndate.Text) Then
        MsgBox "请输入出生日期!", vbOKOnly + vbExclamation, "警告"
        txtBorndate.SetFocus
        Exit Sub
    End If
    
    If Not Testtxt(comboClassno.Text) Then
        MsgBox "请选择班号!", vbOKOnly + vbExclamation, "警告"
        comboClassno.SetFocus
        Exit Sub
    End If
    
    If Not Testtxt(txtTel.Text) Then
        MsgBox "请输入联系电话!", vbOKOnly + vbExclamation, "警告"
        txtTel.SetFocus
        Exit Sub
    End If
    
    If Not Testtxt(txtRudate.Text) Then
        MsgBox "请输入入校日期!", vbOKOnly + vbExclamation, "警告"
        txtRudate.SetFocus
        Exit Sub
    End If
    
    If Not Testtxt(txtAddress.Text) Then
        MsgBox "请输入家庭住址!", vbOKOnly + vbExclamation, "警告"
        txtAddress.SetFocus
        Exit Sub
    End If
    
    If Not IsNumeric(Trim(txtSID.Text)) Then
        MsgBox "请输入数字!", vbOKOnly + vbExclamation, "警告"
        Exit Sub
        txtSID.SetFocus
    End If
    
    
    
    txtSQL = "select * from student_Info where student_ID = '" & Trim(txtSID.Text) & "'"
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    If mrc.EOF = False Then
        MsgBox "学号重复,请重新输入!", vbOKOnly + vbExclamation, "警告"
        mrc.Close
        txtSID.SetFocus
    Else
        mrc.Close
        If Not IsDate(txtBorndate.Text) Then
            MsgBox "出生时间应输入日期格式(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告"
            txtBorndate.SetFocus
        Else
            txtBorndate = Format(txtBorndate, "yyyy-mm-dd")
            If Not IsDate(txtRudate.Text) Then
                MsgBox "入校时间应输入日期格式(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告"
                txtRudate.SetFocus
            Else
                txtRudate = Format(txtRudate, "yyyy-mm-dd")
                txtSQL = "select * from student_Info"
                Set mrc = ExecuteSQL(txtSQL, MsgText)
                mrc.AddNew
                mrc.Fields(0) = Trim(txtSID.Text)
                mrc.Fields(1) = Trim(txtName.Text)
                mrc.Fields(2) = Trim(comboSex.Text)
                mrc.Fields(3) = Trim(txtBorndate.Text)
                mrc.Fields(4) = Trim(comboClassno.Text)
                mrc.Fields(5) = Trim(txtTel.Text)
                mrc.Fields(6) = Trim(txtRudate.Text)
                mrc.Fields(7) = Trim(txtAddress.Text)
                mrc.Fields(8) = Trim(txtComment.Text)
                mrc.Update
                MsgBox "添加学籍信息成功!", vbOKOnly + vbExclamation, "警告"
                mrc.Close
                Me.Hide
            End If
        End If
    End If
            
      
     
    
    
    
    
    
End Sub

Private Sub Command2_Click()
    
    Unload Me
End Sub

Private Sub Form_Load()
    Dim mrc As ADODB.Recordset
    Dim txtSQL As String
    Dim MsgText As String
    Dim i As Integer
    
    comboSex.AddItem "男"
    comboSex.AddItem "女"
    txtSQL = "select * from class_Info "
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    
    For i = 1 To mrc.RecordCount
        comboClassno.AddItem mrc.Fields(0)
        mrc.MoveNext
    Next i
    
    mrc.Close
End Sub

⌨️ 快捷键说明

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