frmModifycourseinfo.frm
上传用户:rocksue
上传日期:2013-06-17
资源大小:41926k
文件大小:16k
- VERSION 5.00
- Begin VB.Form frmModifycourseinfo
- Caption = "修改课程信息"
- ClientHeight = 5628
- ClientLeft = 48
- ClientTop = 348
- ClientWidth = 7824
- LinkTopic = "Form1"
- ScaleHeight = 5628
- ScaleWidth = 7824
- StartUpPosition = 3 'Windows Default
- Begin VB.Frame Frame3
- Caption = "修改课程信息"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 1092
- Left = 360
- TabIndex = 13
- Top = 4080
- Width = 6972
- Begin VB.CommandButton editCommand
- Caption = "修改记录"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 492
- Left = 240
- TabIndex = 17
- Top = 360
- Width = 1452
- End
- Begin VB.CommandButton updateCommand
- Caption = "更新数据"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 492
- Left = 1800
- TabIndex = 16
- Top = 360
- Width = 1452
- End
- Begin VB.CommandButton cancelCommand
- Caption = "取消修改记录"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 492
- Left = 3360
- TabIndex = 15
- Top = 360
- Width = 1692
- End
- Begin VB.CommandButton deleteCommand
- Caption = "删除记录"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 492
- Left = 5160
- TabIndex = 14
- Top = 360
- Width = 1452
- End
- End
- Begin VB.Frame Frame2
- Caption = "查看课程信息"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 1092
- Left = 360
- TabIndex = 8
- Top = 2880
- Width = 6972
- Begin VB.CommandButton firstCommand
- Caption = "第一条记录"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 492
- Left = 240
- TabIndex = 12
- Top = 360
- Width = 1452
- End
- Begin VB.CommandButton previousCommand
- Caption = "上一条记录"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 492
- Left = 1800
- TabIndex = 11
- Top = 360
- Width = 1452
- End
- Begin VB.CommandButton nextCommand
- Caption = "下一条记录"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 492
- Left = 3360
- TabIndex = 10
- Top = 360
- Width = 1452
- End
- Begin VB.CommandButton lastCommand
- Caption = "最后一条记录"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 12
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 492
- Left = 4920
- TabIndex = 9
- Top = 360
- Width = 1692
- End
- End
- Begin VB.TextBox txtCourseno
- BeginProperty Font
- Name = "宋体"
- Size = 10.8
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 492
- Left = 1680
- TabIndex = 3
- Top = 240
- Width = 1332
- End
- Begin VB.TextBox txtCoursename
- BeginProperty Font
- Name = "宋体"
- Size = 10.8
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 492
- Left = 4800
- TabIndex = 2
- Top = 240
- Width = 1332
- End
- Begin VB.TextBox txtCoursedes
- BeginProperty Font
- Name = "宋体"
- Size = 10.8
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 1452
- Left = 4800
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 1
- Top = 1080
- Width = 2412
- End
- Begin VB.ComboBox comboCoursetype
- BeginProperty Font
- Name = "宋体"
- Size = 10.8
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 312
- Left = 1680
- TabIndex = 0
- Top = 1200
- Width = 1332
- End
- Begin VB.Label Label1
- Caption = "课程编号:"
- BeginProperty Font
- Name = "宋体"
- Size = 10.8
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 252
- Left = 360
- TabIndex = 7
- Top = 360
- Width = 1212
- End
- Begin VB.Label Label2
- Caption = "课程名称:"
- BeginProperty Font
- Name = "宋体"
- Size = 10.8
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 252
- Left = 3480
- TabIndex = 6
- Top = 360
- Width = 1212
- End
- Begin VB.Label Label3
- Caption = "课程类型:"
- BeginProperty Font
- Name = "宋体"
- Size = 10.8
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 252
- Left = 360
- TabIndex = 5
- Top = 1200
- Width = 1212
- End
- Begin VB.Label Label4
- Caption = "课程描述:"
- BeginProperty Font
- Name = "宋体"
- Size = 10.8
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 252
- Left = 3480
- TabIndex = 4
- Top = 1200
- Width = 1212
- End
- End
- Attribute VB_Name = "frmModifycourseinfo"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Dim mrc As ADODB.Recordset
- Dim myBookmark As Variant
- Dim mcclean As Boolean
- Private Sub cancelCommand_Click()
- If Not mcclean Then
- 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
-
- mrc.Bookmark = myBookmark
- Call viewData
- Else
- MsgBox "什么都没有修改,有什么好取消的!", vbOKOnly + vbExclamation, "警告"
- End If
- End Sub
- Private Sub deleteCommand_Click()
- myBookmark = mrc.Bookmark
- str2$ = MsgBox("是否删除当前记录?", vbOKCancel, "删除当前记录")
- If str2$ = vbOK Then
- mrc.MoveNext
- If mrc.EOF Then
- mrc.MoveFirst
- myBookmark = mrc.Bookmark
- mrc.MoveLast
- mrc.Delete
- mrc.Bookmark = myBookmark
- Call viewData
- Else
- myBookmark = mrc.Bookmark
- mrc.MovePrevious
- mrc.Delete
- mrc.Bookmark = myBookmark
- Call viewData
- End If
- Else
- mrc.Bookmark = myBookmark
- Call viewData
- End If
- End Sub
- Private Sub editCommand_Click()
- mcclean = False
- Frame2.Enabled = False
- firstCommand.Enabled = False
- previousCommand.Enabled = False
- nextCommand.Enabled = False
- lastCommand.Enabled = False
-
- txtCourseno.Enabled = True
- txtCoursename.Enabled = True
- comboCoursetype.Enabled = True
- txtCoursedes.Enabled = True
-
- comboCoursetype.AddItem "必修"
- comboCoursetype.AddItem "考查"
-
-
- myBookmark = mrc.Bookmark
- End Sub
- Private Sub firstCommand_Click()
- mrc.MoveFirst
- Call viewData
- End Sub
- Private Sub Form_Load()
- Dim txtSQL As String
- Dim MsgText As String
-
- txtCourseno.Enabled = False
- txtCoursename.Enabled = False
- comboCoursetype.Enabled = False
- txtCoursedes.Enabled = False
-
- txtSQL = "select * from course_Info "
- Set mrc = ExecuteSQL(txtSQL, MsgText)
- mrc.MoveFirst
- Call viewData
- myBookmark = mrc.Bookmark
- mcclean = True
- End Sub
- 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
-
- mcclean = True
- End If
- End Sub