📄 frmcourse.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form FrmCourse
Caption = "课程信息"
ClientHeight = 5760
ClientLeft = 60
ClientTop = 450
ClientWidth = 7980
LinkTopic = "Form2"
Picture = "FrmCourse.frx":0000
ScaleHeight = 5760
ScaleWidth = 7980
StartUpPosition = 3 '窗口缺省
Begin VB.ComboBox ComSeaType
Height = 300
ItemData = "FrmCourse.frx":C0E2
Left = 360
List = "FrmCourse.frx":C0F2
TabIndex = 21
Text = "请选择查询条件"
Top = 3840
Width = 1695
End
Begin VB.TextBox TxtSearchName
Height = 270
Left = 2040
TabIndex = 20
Text = "请输入查询关键字"
Top = 3840
Width = 1575
End
Begin MSAdodcLib.Adodc AdodcCourse
Height = 330
Left = 1800
Top = 3240
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
ConnectMode = 16
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=student"
OLEDBString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=student"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "course"
Caption = "AdodcCourse"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Frame FraCourse
BackColor = &H80000013&
Caption = "课程信息"
Height = 2055
Left = 480
TabIndex = 10
Top = 240
Width = 6375
Begin VB.TextBox TxtCno
DataField = "Cno"
DataSource = "AdodcCourse"
Height = 375
Left = 960
TabIndex = 14
Top = 600
Width = 1695
End
Begin VB.TextBox TxtCname
DataField = "Cname"
DataSource = "AdodcCourse"
Height = 375
Left = 3600
TabIndex = 13
Top = 600
Width = 1695
End
Begin VB.TextBox TxtCsemester
DataField = "Csemester"
DataSource = "AdodcCourse"
Height = 375
Left = 960
TabIndex = 12
Top = 1200
Width = 1695
End
Begin VB.TextBox TxtCredit
DataField = "Credit"
DataSource = "AdodcCourse"
Height = 375
Left = 3600
TabIndex = 11
Top = 1200
Width = 1695
End
Begin VB.Label LabCno
Caption = "课程号:"
Height = 375
Left = 240
TabIndex = 18
Top = 600
Width = 975
End
Begin VB.Label LabCname
Caption = "课程名:"
Height = 375
Left = 2880
TabIndex = 17
Top = 600
Width = 975
End
Begin VB.Label LabCsemester
Caption = "授课学期:"
Height = 375
Left = 120
TabIndex = 16
Top = 1200
Width = 1095
End
Begin VB.Label LabCredit
Caption = "学分:"
Height = 375
Left = 3000
TabIndex = 15
Top = 1200
Width = 735
End
End
Begin VB.CommandButton CmdFirst
Caption = "第一条"
Height = 495
Left = 240
TabIndex = 9
Top = 2520
Width = 855
End
Begin VB.CommandButton CmdPrevious
Caption = "前一条"
Height = 495
Left = 1200
TabIndex = 8
Top = 2520
Width = 855
End
Begin VB.CommandButton CmdNext
Caption = "后一条"
Height = 495
Left = 2160
TabIndex = 7
Top = 2520
Width = 855
End
Begin VB.CommandButton CmdLast
Caption = "末一条"
Height = 495
Left = 3120
TabIndex = 6
Top = 2520
Width = 855
End
Begin VB.CommandButton CmdAdd
Caption = "增 加"
Height = 495
Left = 4320
TabIndex = 5
Top = 2520
Width = 975
End
Begin VB.CommandButton CmdDelete
Caption = "删 除"
Height = 495
Left = 5760
TabIndex = 4
Top = 2520
Width = 975
End
Begin VB.CommandButton CmdUpdate
Caption = "更 新"
Height = 495
Left = 4320
TabIndex = 3
Top = 3120
Width = 975
End
Begin VB.CommandButton CmdCancel
Caption = "取 消"
Height = 495
Left = 5760
TabIndex = 2
Top = 3120
Width = 975
End
Begin VB.CommandButton CmdSearch
Caption = "查找"
Height = 375
Left = 3720
TabIndex = 1
Top = 3840
Width = 615
End
Begin VB.CommandButton CmdQuit
Caption = "退 出"
Height = 495
Left = 5640
Style = 1 'Graphical
TabIndex = 0
Top = 3960
Width = 1215
End
Begin VB.Label LabSearch
Caption = "查询条件:"
Height = 255
Left = 360
TabIndex = 19
Top = 3240
Width = 1215
End
End
Attribute VB_Name = "FrmCourse"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public SearchName As String
Public SearchType As String
Private Sub ComSeaType_Click()
Dim t As String
t = ComSeaType.Text
Select Case t
Case "课程号"
SearchType = "Cno"
Case "课程名"
SearchType = "Cname"
Case "授课学期"
SearchType = "Csemester"
Case "学分"
SearchType = "Credit"
Case Else
MsgBox "你没有选中任何条件!", vbOKOnly + vbExclamation, "警告"
End Select
TxtSearchName.SetFocus
End Sub
Private Sub CmdSearch_Click()
SearchName = TxtSearchName.Text
Unload Me
FrmCsearch.Show
End Sub
Private Sub Form_Load()
CmdCancel.Enabled = False
CmdUpdate.Enabled = False
End Sub
Private Sub CmdAdd_Click()
AdodcCourse.Recordset.AddNew
CmdDelete.Enabled = False
CmdAdd.Enabled = False
CmdUpdate.Enabled = True
CmdCancel.Enabled = True
Call EnableButton(False)
TxtCno.SetFocus
End Sub
Private Sub CmdCancel_Click()
AdodcCourse.Recordset.CancelUpdate
CmdAdd.Enabled = True
CmdDelete.Enabled = True
CmdUpdate.Enabled = False
CmdCancel.Enabled = False
Call EnableButton(True)
End Sub
Private Sub CmdDelete_Click()
Dim r As Integer
r = MsgBox("确定删除当前记录?", vbExclamation + vbYesNo)
If r = vbYes Then
With AdodcCourse.Recordset
.Delete
.MoveNext
If .EOF Then .MoveLast
End With
End If
End Sub
Private Sub CmdFirst_Click()
AdodcCourse.Recordset.MoveFirst
End Sub
Private Sub CmdPrevious_Click()
With AdodcCourse.Recordset
.MovePrevious
If .BOF Then .MoveFirst
End With
End Sub
Private Sub CmdNext_Click()
With AdodcCourse.Recordset
.MoveNext
If .EOF Then .MoveLast
End With
End Sub
Private Sub CmdLast_Click()
AdodcCourse.Recordset.MoveLast
End Sub
Private Sub CmdQuit_Click()
FrmChoose.Show
Unload Me
End Sub
Private Sub CmdUpdate_Click()
If TxtCno.Text = "" Then
MsgBox "课程号不能为空,请重新输入", vbExclamation, "信息"
TxtSearchName.SetFocus
Else
If TxtCname.Text = "" Then
MsgBox "课程名不能为空,请重新输入", vbExclamation, "信息"
TxtCname.SetFocus
Else
With AdodcCourse
.Recordset("Cno") = TxtCno.Text
.Recordset("Cname") = TxtCname.Text
.Recordset("Csemester") = TxtCsemester.Text
.Recordset("Credit") = TxtCredit.Text
End With
AdodcCourse.Recordset.Update
CmdAdd.Enabled = True
CmdDelete.Enabled = True
CmdUpdate.Enabled = False
CmdCancel.Enabled = False
Call EnableButton(True)
End If
End If
End Sub
Private Sub EnableButton(flag As Boolean)
CmdFirst.Enabled = flag
CmdPrevious.Enabled = flag
CmdNext.Enabled = flag
CmdLast.Enabled = flag
End Sub
Private Function ConvertNull(para_Value As Variant) As Variant
If IsNull(para_Value) = True Then
ConvertNull = ""
Else
ConvertNull = para_Value
End If
End Function
Private Sub TxtSearchName_GotFocus()
TxtSearchName.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -