VB+SQL server学生信息管理系统毕业论文附源代码 第21页

Private Sub firstCommand_Click()

mrc.MoveFirst

Call viewData

End Sub

 

Private Sub Form_Load()

 

Dim txtSQL As String

Dim MsgText As String

 

txtSQL = "select * from student_Info "

Set mrc = ExecuteSQL(txtSQL, MsgText)

 

mrc.MoveFirst

Call viewData

mcbookmark = mrc.Bookmark

mcclean = True

End Sub

 

Public Sub viewData()

txtSID.Text = mrc.Fields(0)

txtName.Text = mrc.Fields(1)

comboSex.Text = mrc.Fields(2)

txtBorndate.Text = Format(mrc.Fields(3), "yyyy-mm-dd")

comboClassNo.Text = mrc.Fields(4)

txtTel.Text = mrc.Fields(5)

txtRudate.Text = Format(mrc.Fields(6), "yyyy-mm-dd")

txtAddress.Text = mrc.Fields(7)

txtComment.Text = mrc.Fields(8)

End Sub

 

Private Sub lastCommand_Click()

mrc.MoveLast

Call viewData

End Sub

 

Private Sub nextCommand_Click()

mrc.MoveNext

If mrc.EOF Then

mrc.MoveFirst

End If

Call viewData

End Sub

 

Private Sub previousCommand_Click()

mrc.MovePrevious

If mrc.BOF Then

mrc.MoveLast

End If

Call viewData

End Sub

 

Private Sub updateCommand_Click()

Dim txtSQL As String

Dim MsgText As String

Dim mrcc As ADODB.Recordset

 

If mcclean Then

MsgBox "请先修改学籍信息", vbOKOnly + vbExclamation, "警告"

Exit Sub

End If

 

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, "警告"

txtSID.SetFocus

Exit Sub

 

End If

 

mrc.Delete

txtSQL = "select * from student_Info where student_ID = '" & Trim(txtSID.Text) & "'"

Set mrcc = ExecuteSQL(txtSQL, MsgText)

If mrcc.EOF = False Then

MsgBox "学号重复,请重新输入!", vbOKOnly + vbExclamation, "警告"

mrcc.Close

txtSID.SetFocus

Else

mrcc.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")

 

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.Bookmark = myBookmark

Call viewData

Frame2.Enabled = True

firstCommand.Enabled = True

previousCommand.Enabled = True

nextCommand.Enabled = True

lastCommand.Enabled = True

 

txtSID.Enabled = False

txtName.Enabled = False

comboSex.Enabled = False

txtBorndate.Enabled = False

comboClassNo.Enabled = False

txtRudate.Enabled = False

txtTel.Enabled = False

txtAddress.Enabled = False

txtComment.Enabled = False

 

mcclean = True

 

End If

End If

End If

 

End Sub

 << 上一页  [21] [22] [23] [24] [25] [26] [27] [28] [29] 下一页

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有