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

📄 frminput1.frm

📁 新完成的毕业设计学籍管理系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Left            =   3720
         TabIndex        =   9
         Top             =   1800
         Width           =   855
      End
      Begin VB.Label Label8 
         BackColor       =   &H00C0FFC0&
         Caption         =   "地址;"
         ForeColor       =   &H00FF0000&
         Height          =   255
         Left            =   3720
         TabIndex        =   8
         Top             =   1200
         Width           =   1455
      End
      Begin VB.Label Label7 
         BackColor       =   &H00C0FFC0&
         Caption         =   "父母姓名:"
         ForeColor       =   &H00FF0000&
         Height          =   255
         Left            =   3720
         TabIndex        =   7
         Top             =   600
         Width           =   1215
      End
      Begin VB.Label Label6 
         BackColor       =   &H00C0FFC0&
         Caption         =   "民族:"
         ForeColor       =   &H00FF0000&
         Height          =   495
         Left            =   240
         TabIndex        =   6
         Top             =   3360
         Width           =   1095
      End
      Begin VB.Label Label5 
         BackColor       =   &H00C0FFC0&
         Caption         =   "出生年月"
         ForeColor       =   &H00FF0000&
         Height          =   375
         Left            =   240
         TabIndex        =   5
         Top             =   2760
         Width           =   735
      End
      Begin VB.Label Label4 
         BackColor       =   &H00C0FFC0&
         Caption         =   "性别"
         ForeColor       =   &H00FF0000&
         Height          =   375
         Left            =   240
         TabIndex        =   4
         Top             =   2280
         Width           =   735
      End
      Begin VB.Label Label3 
         BackColor       =   &H00C0FFC0&
         Caption         =   "名字:"
         ForeColor       =   &H00FF0000&
         Height          =   375
         Left            =   240
         TabIndex        =   3
         Top             =   1800
         Width           =   855
      End
      Begin VB.Label Label2 
         BackColor       =   &H00C0FFC0&
         Caption         =   "班级"
         ForeColor       =   &H00FF0000&
         Height          =   375
         Left            =   240
         TabIndex        =   2
         Top             =   1200
         Width           =   855
      End
      Begin VB.Label Label1 
         BackColor       =   &H00C0FFC0&
         Caption         =   "学号:"
         ForeColor       =   &H00FF0000&
         Height          =   375
         Left            =   240
         TabIndex        =   1
         Top             =   600
         Width           =   1215
      End
   End
End
Attribute VB_Name = "FrmInput"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rs As New ADODB.Recordset

Private Sub Command1_Click()
On Error GoTo AddErr
'Text1.Enabled = True
If Text1.Text = "" Then
   MsgBox "请输入学号!", vbOKOnly + vbExclamation, "警告"
   Text1.SetFocus
   Exit Sub
End If
If Text3.Text = "" Then
   MsgBox "请输入名字!", vbOKOnly + vbExclamation, "警告"
   Text3.SetFocus
   Exit Sub
End If
If Combo1.Text = "" Then
   MsgBox "请输入性别!", vbOKOnly + vbExclamation, "警告"
   Combo1.SetFocus
   Exit Sub
End If
If Text5.Text = "" Then
   MsgBox "请输入民族!"
   Text5.SetFocus
   Exit Sub
End If
If Text6.Text = "" Then
   MsgBox "请输入父母姓名!", vbOKOnly + vbExclamation, "警告"
   Text6.SetFocus
   Exit Sub
End If
If Text4.Text = "" Then
   MsgBox "请输入出生年月!出生年月应输入日期格式(YYYY-MM-DD)!", vbOKOnly + vbExclamation, "警告"
   Text4.SetFocus
   Exit Sub
End If
If Text7.Text = "" Then
   MsgBox "请输入地址!", vbOKOnly + vbExclamation, "警告"
   Text7.SetFocus
   Exit Sub
End If
If Text8.Text = "" Then
   MsgBox "请输入邮政编码!", vbOKOnly + vbExclamation, "警告"
   Text8.SetFocus
   Exit Sub
End If
If Text2.Text = "" Then
   MsgBox "请输入班级!", vbOKOnly + vbExclamation, "警告"
   Text2.SetFocus
   Exit Sub
End If
If Combo3.Text = "" Then
   MsgBox "请输入专业!", vbOKOnly + vbExclamation, "警告"
   Combo3.SetFocus
   Exit Sub
End If
If Combo2.Text = "" Then
   MsgBox "请输入院系!", vbOKOnly + vbExclamation, "警告"
   Combo2.SetFocus
   Exit Sub
End If
If Text9.Text = "" Then
   MsgBox "请输入电话号码!", vbOKOnly + vbExclamation, "警告"
   Text9.SetFocus
   Exit Sub
End If
'txtSQL = "select * from 学生 where 学号='" & Trim(Text1.Text) & "' "
'Set mrc = cn.Execute(txtSQL)
'mrc.LockType = adLockOptimistic
'mrc.CursorType = adOpenKeyset
'mrc.Open txtSQL, cn, adOpenDynamic, adLockOptimistic, adCmdText
'Adodc2.RecordSource = "select * from 学生 where 学号='" & Trim(Text1.Text) & "' "
' mrc.EOF = False Then
If check1 = False Then
   MsgBox "学号重复!", vbOKOnly + vbExclamation, "警告"
   Text1.SetFocus
Else
   
   'If Text4.Text <> "" Then
      'MsgBox "出生年月应输入日期格式(YYYY-MM-DD)!", vbOKOnly + vbExclamation, "O警告"
      'Text4.SetFocus
   'Else
      'Adodc2.RecordSource = "select * from 学生"
      'txtSQL = "select * from 学生"
      'mrc.LockType = adLockOptimistic
      'mrc.CursorType = adOpenKeyset
      'mrc.Open txtSQL, cn, adOpenDynamic, adLockOptimistic, adCmdText
      'mrc.AddNew
   Adodc1.Recordset.AddNew
      Adodc1.Recordset.Fields("学号").Value = Text1.Text
      Adodc1.Recordset.Fields("名字").Value = Text3.Text
      Adodc1.Recordset.Fields("班级").Value = Text2.Text
      Adodc1.Recordset.Fields("性别").Value = Combo1.Text
      Adodc1.Recordset.Fields("出生年月").Value = Text4.Text
      Adodc1.Recordset.Fields("民族").Value = Text5.Text
      Adodc1.Recordset.Fields("父母姓名").Value = Text6.Text
      Adodc1.Recordset.Fields("地址").Value = Text7.Text
      Adodc1.Recordset.Fields("邮政编码").Value = Text8.Text
      Adodc1.Recordset.Fields("电话号码").Value = Text9.Text
      Adodc1.Recordset.Fields("院系").Value = Combo2.Text
      Adodc1.Recordset.Fields("专业").Value = Combo3.Text
      Adodc1.Recordset.Fields("附注").Value = Text12.Text
      Adodc1.Recordset.Update
      'Adodc1.Recordset.Close
      MsgBox "添加成功!", vbOKOnly + vbExclamation, "警告"
     Exit Sub
 End If
AddErr:
    MsgBox Err.Description
    Exit Sub
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()
On Error GoTo errh
    MakeCenter FrmInput
    Combo1.AddItem "男"
    Combo1.AddItem "女"
    Set rs = cn.Execute("SELECT distinct 院系,专业 FROM 学生")
    rs.MoveFirst
    Do
        Combo2.AddItem rs.Fields(0).Value
        Combo3.AddItem rs.Fields(1).Value
        rs.MoveNext
    Loop Until rs.EOF
    Exit Sub
errh:
    rs.Close
    MsgBox Err.Description
End Sub

Private Function check1() As Boolean '检测添加的课程是否重复
On Error GoTo errh
     
    Set rs = cn.Execute("SELECT 学号 FROM 学生 WHERE 学号='" & Trim(Text1.Text) & "'")
    ' Adodc2.RecordSource = "select * from 课程 where 课程号='" & Trim(Text1.Text) & "' and 课程名称='" & Trim(Text2.Text) & "' "
        If rs.EOF Then
            rs.Close
            check1 = True
            Exit Function
        End If
    check1 = False
    rs.Close
    Exit Function
errh:
    rs.Close
    MsgBox Err.Description
End Function

⌨️ 快捷键说明

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