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
.........................................................................................................
............................... frmAddassinfo 添加班级信息窗口代码 ..............................
Private Sub Command1_Click()
Dim mrc As ADODB.Recordset
Dim MsgText As String
Dim txtSQL As String
If Not Testtxt(txtClassno.Text) Then
MsgBox "请输入班号!", vbOKOnly + vbExclamation, "警告"
txtClassno.SetFocus
Exit Sub
End If
<< 上一页 [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] ... 下一页 >>