VB+SQL server学生信息管理系统毕业论文附源代码 第24页
Public Sub viewData()
txtCourseno.Text = mrc.Fields(0)
txtCoursename.Text = mrc.Fields(1)
comboCoursetype.Text = mrc.Fields(2)
txtCoursedes.Text = mrc.Fields(3)
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(txtCourseno.Text) Then
MsgBox "请输入课程编号!", vbOKOnly + vbExclamation, "警告"
txtCourseno.SetFocus
Exit Sub
End If
If Not IsNumeric(Trim(txtCourseno.Text)) Then
MsgBox "课程编号请输入数字!", vbOKOnly + vbExclamation, "警告"
txtCourseno.SetFocus
Exit Sub
End If
If Not Testtxt(txtCoursename.Text) Then
MsgBox "请输入课程名称!", vbOKOnly + vbExclamation, "警告"
txtCoursename.SetFocus
Exit Sub
End If
If Not Testtxt(comboCoursetype.Text) Then
MsgBox "请选择课程类型!", vbOKOnly + vbExclamation, "警告"
comboCoursetype.SetFocus
Exit Sub
End If
If Not Testtxt(txtCoursedes.Text) Then
MsgBox "请输入课程描述信息!", vbOKOnly + vbExclamation, "警告"
txtCoursedes.SetFocus
Exit Sub
End If
mrc.Delete
txtSQL = "select * from course_Info where course_No = '" & Trim(txtCourseno.Text) & "'"
Set mrcc = ExecuteSQL(txtSQL, MsgText)
If mrcc.EOF = False Then
MsgBox "课程编号重复,请重新输入!", vbOKOnly + vbExclamation, "警告"
mrcc.Close
txtCourseno.SetFocus
Else
mrcc.Close
mrc.AddNew
mrc.Fields(0) = Trim(txtCourseno.Text)
mrc.Fields(1) = Trim(txtCoursename.Text)
mrc.Fields(2) = Trim(comboCoursetype.Text)
mrc.Fields(3) = Trim(txtCoursedes.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
txtCourseno.Enabled = False
txtCoursename.Enabled = False
comboCoursetype.Enabled = False
txtCoursedes.Enabled = False
<< 上一页 [21] [22] [23] [24] [25] [26] [27] [28] [29] 下一页