📄 frmcoursequery.frm
字号:
VERSION 5.00
Object = "{CE671F01-259E-40DA-92FE-95803E2ECBB5}#1.0#0"; "SmartXPButton.ocx"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Begin VB.Form FrmCourseQuery
BackColor = &H00E7DFE7&
BorderStyle = 1 'Fixed Single
Caption = "课程信息查询"
ClientHeight = 5745
ClientLeft = 45
ClientTop = 330
ClientWidth = 10200
Icon = "FrmCourseQuery.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 5745
ScaleWidth = 10200
Begin VB.Frame Frame2
BackColor = &H00E7DFE7&
Caption = "查询条件"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 1740
Left = 120
TabIndex = 7
Top = 3840
Width = 9960
Begin VB.TextBox txtCourseDes
Height = 375
Left = 1515
TabIndex = 2
Top = 1080
Width = 1695
End
Begin VB.ComboBox cboCourseNo
Height = 300
Left = 1515
TabIndex = 0
Top = 435
Width = 1100
End
Begin VB.ComboBox cboCourseName
Height = 300
Left = 4770
TabIndex = 1
Top = 435
Width = 2775
End
Begin VB.ComboBox cboCourseType
Height = 300
Left = 4770
TabIndex = 3
Top = 1155
Width = 2775
End
Begin SmartXPButton.XpButton cmdExit
Cancel = -1 'True
Height = 495
Left = 8400
TabIndex = 5
Top = 1080
Width = 1335
_ExtentX = 2355
_ExtentY = 873
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "关闭(&E)"
CaptionMouseOverColor= 16711680
PictureBackColor= 15790320
PictureSmoothBackColor= 15790320
ButtonPicture = "FrmCourseQuery.frx":2CFA
End
Begin SmartXPButton.XpButton cmdQuery
Height = 495
Left = 8400
TabIndex = 4
Top = 360
Width = 1335
_ExtentX = 2355
_ExtentY = 873
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "查找(&F)"
CaptionMouseOverColor= 16711680
PictureBackColor= 15790320
PictureSmoothBackColor= 15790320
ButtonPicture = "FrmCourseQuery.frx":35D4
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "课程描述:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 360
TabIndex = 11
Top = 1200
Width = 945
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "课程类型:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 3600
TabIndex = 10
Top = 1200
Width = 945
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "课程名称:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 3600
TabIndex = 9
Top = 480
Width = 945
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "课程编号:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 360
TabIndex = 8
Top = 480
Width = 945
End
End
Begin MSHierarchicalFlexGridLib.MSHFlexGrid CourseGrid
Height = 3375
Left = 120
TabIndex = 6
Top = 120
Width = 9960
_ExtentX = 17568
_ExtentY = 5953
_Version = 393216
BackColorFixed = 15196135
BackColorBkg = 15196135
BackColorUnpopulated= 15196135
_NumberOfBands = 1
_Band(0).Cols = 2
End
End
Attribute VB_Name = "FrmCourseQuery"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim CourseQuery As OpenRs
Dim sql As String
Dim sql1 As String
Dim sql2 As String
Dim sql3 As String
Dim sql4 As String
Private Sub cboCourseName_KeyPress(KeyAscii As Integer)
If KeyAscii = 39 Then KeyAscii = 0
End Sub
Private Sub cboCourseNo_KeyPress(KeyAscii As Integer)
If Not (Chr(KeyAscii) <= "9" And Chr(KeyAscii) >= "0" Or KeyAscii = 8) Then
KeyAscii = 0
End If
End Sub
Private Sub cboCourseType_KeyPress(KeyAscii As Integer)
If KeyAscii = 39 Then KeyAscii = 0
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub CmdQuery_Click()
sql = "select * from course_info where 1=1"
If cboCourseNo.Text <> "" Then
sql1 = " and course_no='" & cboCourseNo.Text & "'"
Else
sql1 = " "
End If
If txtCourseDes.Text <> "" Then
sql2 = " and course_des='" & txtCourseDes.Text & "'"
Else
sql2 = " "
End If
If cboCourseName.Text <> "" Then
sql3 = " and course_name='" & cboCourseName.Text & "'"
Else
sql3 = " "
End If
If cboCourseType.Text <> "" Then
sql4 = " and course_type='" & cboCourseType.Text & "'"
Else
sql4 = " "
End If
sql = sql & sql1 & sql2 & sql3 & sql4
CourseQuery.rsDK1 sql
If CourseQuery.rs1.EOF Then
CourseGrid.Clear
CourseGrid.FormatString = " | 课程编号| 课程名称| 课程类型| 课程描述"
MsgBox "没有找到符合条件的记录!", vbOKOnly + vbInformation, "提示"
Else
Set CourseGrid.DataSource = CourseQuery.rs1
CourseGrid.FormatString = " | 课程编号| 课程名称| 课程类型| 课程描述"
End If
End Sub
Private Sub Form_Load()
Set CourseQuery = New OpenRs
CourseGrid.FormatString = " | 课程编号| 课程名称| 课程类型| 课程描述"
CourseQuery.rsDK1 "select * from course_info"
If CourseQuery.rs1.EOF Then
CourseGrid.Clear
CourseGrid.FormatString = " | 课程编号| 课程名称| 课程类型| 课程描述"
Else
Set CourseGrid.DataSource = CourseQuery.rs1
CourseGrid.FormatString = " | 课程编号| 课程名称| 课程类型| 课程描述"
End If
CourseQuery.rsDK1 "select course_no from course_info"
While Not CourseQuery.rs1.EOF
cboCourseNo.AddItem CourseQuery.rs1!course_no
CourseQuery.rs1.MoveNext
Wend
CourseQuery.rsDK1 "select distinct course_name from course_info"
While Not CourseQuery.rs1.EOF
cboCourseName.AddItem CourseQuery.rs1!course_name
CourseQuery.rs1.MoveNext
Wend
CourseQuery.rsDK1 "select distinct course_type from course_info"
While Not CourseQuery.rs1.EOF
cboCourseType.AddItem CourseQuery.rs1!course_type
CourseQuery.rs1.MoveNext
Wend
End Sub
Private Sub txtCourseDes_KeyPress(KeyAscii As Integer)
If KeyAscii = 39 Then KeyAscii = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -