【机房收费系统】——注册

来了来了,来来来上上!!! 这次是注册

Private Sub cmdStorage_Click()
    Dim mrc As ADODB.Recordset
    Dim MsgText As String
    Dim txtSQL As String
    
    txtSQL = "select * from student_Info "  '查询学生表
    Set mrc = ExecuteSQL(txtSQL, MsgText)   '赋值
    
    If Not (mrc.EOF And mrc.BOF) Then   '数据库里一定有数据
        mrc.MoveFirst   '指针移动到第一条数据
    End If
    
    While (mrc.EOF = False)     '这条数据在这个表中存在
        If (Trim(mrc.Fields(0)) = Trim(txtCardNumber.Text)) Then    '用文本框的卡号查询
            MsgBox "卡号已经存在,请重新输入卡号!", vbOKOnly + vbExclamation, "警告"
            txtCardNumber.Text = ""     '清空
            txtCardNumber.SetFocus      '获取焦点
            Exit Sub
        Else
            mrc.MoveNext
        End If
    Wend
    
    mrc.AddNew
    mrc.Fields(0) = Trim(txtClassno.Text)
    mrc.Fields(7) = Trim(txtMoney.Text)
    mrc.Fields(1) = Trim(txtStudentID.Text)
    mrc.Fields(2) = Trim(txtName.Text)
    mrc.Fields(3) = Trim(cboSex.Text)
    mrc.Fields(4) = Trim(txtSystem.Text)
    mrc.Fields(5) = Trim(txtgrade.Text)
    mrc.Fields(6) = Trim(txtclass.Text)
    mrc.Fields(10) = Trim(txtState.Text)
    mrc.Fields(14) = Trim(cboType.Text)
    mrc.Fields(8) = Trim(txtNotes.Text)
    
    If Not Testtxt(txtCardNumber.Text) Then
        MsgBox "请输入教室房间号!", vbOKOnly + vbExclamation, "警告"
        txtCardNumber.SetFocus
        Exit Sub
    End If
    
    If Not Testtxt(txtMoney.Text) Then
        MsgBox "请输入充值金额!", vbOKOnly + vbExclamation, "警告"
        txtMoney.SetFocus
        Exit Sub
    End If
    
    If Not Testtxt(txtStudentID.Text) Then
        MsgBox "请输入学号!", vbOKOnly + vbExclamation, "警告"
        txtStudentID.SetFocus
        Exit Sub
    End If
    
    If Not Testtxt(txtName.Text) Then
        MsgBox "请输入姓名!", vbOKOnly + vbExclamation, "警告"
        txtName.SetFocus
        Exit Sub
    End If
    
    If Not Testtxt(cboSex.Text) Then
        MsgBox "请选择性别!", vbOKOnly + vbExclamation, "警告"
        cboSex.SetFocus
        Exit Sub
    End If
    
    If Not Testtxt(txtSystem.Text) Then
        MsgBox "请输入系别!", vbOKOnly + vbExclamation, "警告"
        txtSystem.SetFocus
        Exit Sub
    End If
    
    If Not Testtxt(txtgrade.Text) Then
        MsgBox "请输入年级!", vbOKOnly + vbExclamation, "警告"
        txtgrade.SetFocus
        Exit Sub
    End If
    
    If Not Testtxt(txtclass.Text) Then
        MsgBox "请输入班级!", vbOKOnly + vbExclamation, "警告"
        txtclass.SetFocus
        Exit Sub
    End If
    
    If Not Testtxt(cboType.Text) Then
        MsgBox "请选择类型!", vbOKOnly + vbExclamation, "警告"
        cboType.SetFocus
        Exit Sub
    End If
          
End Sub

 

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值