📄 form3.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{BEEECC20-4D5F-4F8B-BFDC-5D9B6FBDE09D}#1.0#0"; "vsFlex8.ocx"
Begin VB.Form queryinfo
BorderStyle = 1 'Fixed Single
Caption = "员工信息查询"
ClientHeight = 5715
ClientLeft = 45
ClientTop = 435
ClientWidth = 5940
LinkTopic = "Form3"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 5715
ScaleWidth = 5940
Begin VSFlex8Ctl.VSFlexGrid VSFlexGrid1
Height = 2775
Left = 120
TabIndex = 7
Top = 120
Width = 4935
_cx = 8705
_cy = 4895
Appearance = 1
BorderStyle = 1
Enabled = -1 'True
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
MousePointer = 0
BackColor = -2147483643
ForeColor = -2147483640
BackColorFixed = -2147483633
ForeColorFixed = -2147483630
BackColorSel = -2147483635
ForeColorSel = -2147483634
BackColorBkg = -2147483636
BackColorAlternate= -2147483643
GridColor = -2147483633
GridColorFixed = -2147483632
TreeColor = -2147483632
FloodColor = 192
SheetBorder = -2147483642
FocusRect = 1
HighLight = 1
AllowSelection = -1 'True
AllowBigSelection= -1 'True
AllowUserResizing= 0
SelectionMode = 0
GridLines = 1
GridLinesFixed = 2
GridLineWidth = 1
Rows = 50
Cols = 10
FixedRows = 1
FixedCols = 1
RowHeightMin = 0
RowHeightMax = 0
ColWidthMin = 0
ColWidthMax = 0
ExtendLastCol = 0 'False
FormatString = ""
ScrollTrack = 0 'False
ScrollBars = 3
ScrollTips = 0 'False
MergeCells = 0
MergeCompare = 0
AutoResize = -1 'True
AutoSizeMode = 0
AutoSearch = 0
AutoSearchDelay = 2
MultiTotals = -1 'True
SubtotalPosition= 1
OutlineBar = 0
OutlineCol = 0
Ellipsis = 0
ExplorerBar = 0
PicturesOver = 0 'False
FillStyle = 0
RightToLeft = 0 'False
PictureType = 0
TabBehavior = 0
OwnerDraw = 0
Editable = 0
ShowComboButton = 1
WordWrap = 0 'False
TextStyle = 0
TextStyleFixed = 0
OleDragMode = 0
OleDropMode = 0
DataMode = 0
VirtualData = -1 'True
DataMember = ""
ComboSearch = 3
AutoSizeMouse = -1 'True
FrozenRows = 0
FrozenCols = 0
AllowUserFreezing= 0
BackColorFrozen = 0
ForeColorFrozen = 0
WallPaperAlignment= 9
AccessibleName = ""
AccessibleDescription= ""
AccessibleValue = ""
AccessibleRole = 24
End
Begin VB.CommandButton Command3
Caption = "返回"
Height = 375
Left = 3120
TabIndex = 4
Top = 5040
Width = 1095
End
Begin MSAdodcLib.Adodc Adodc1
Height = 495
Left = 1560
Top = 5880
Visible = 0 'False
Width = 1695
_ExtentX = 2990
_ExtentY = 873
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
OLEDBString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 720
TabIndex = 1
Top = 5040
Width = 1095
End
Begin VB.Frame Frame1
Caption = "查询条件"
Height = 1695
Left = 120
TabIndex = 0
Top = 3240
Width = 5415
Begin VB.TextBox Text1
Height = 270
Left = 2400
TabIndex = 6
Top = 480
Width = 1575
End
Begin VB.TextBox Text2
Height = 270
Left = 2400
TabIndex = 5
Top = 1080
Width = 1575
End
Begin VB.OptionButton Option2
Caption = "按姓名查询:"
Height = 375
Left = 240
TabIndex = 3
Top = 960
Width = 1575
End
Begin VB.OptionButton Option1
Caption = "按编号查询:"
Height = 375
Left = 240
TabIndex = 2
Top = 480
Value = -1 'True
Width = 1575
End
End
End
Attribute VB_Name = "queryinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub command1_click()
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
conn.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
conn.Open
Dim StrSQL As String
StrSQL = "select * from 员工档案表 where " '//给定义好的字符变量赋予SQL语句
If Option1.Value = True Or Option2.Value = True Then
If Option1.Value = True Then
StrSQL = StrSQL & "员工编号= '" & Trim(Text1.Text) & "'"
Else
If Option2.Value = True Then '//只有姓名复选框选中时,则
StrSQL = StrSQL & " 员工姓名 = '" & Trim(Text2.Text) & "'"
End If
End If
If rs.State = adStateClosed Then
rs.Open StrSQL, conn, adOpenKeyset, adLockOptimistic, adCmdText
End If
Set VSFlexGrid1.DataSource = rs
VSFlexGrid1.Refresh
rs.Close
Text1.Text = Empty
Text2.Text = Empty
If rs.State = adStateClosed Then
rs.Open "员工档案表", conn, adOpenKeyset, adLockOptimistic, adCmdTable
End If
Set VSFlexGrid1.DataSource = rs.DataSource
End If
End Sub
Private Sub command3_click()
Unload Me
End Sub
Private Sub form_load()
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
conn.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
conn.Open
sqlstr = "select * from 员工档案表"
rs.CursorLocation = adUseClient
rs.Open sqlstr, conn
If rs.RecordCount > 0 Then
Set VSFlexGrid1.DataSource = rs.DataSource
VSFlexGrid1.Refresh
End If
End Sub
Private Sub Option1_Click()
Text1 = " "
Text2 = ""
Text1.SetFocus
End Sub
Private Sub Option2_Click()
Text1 = " "
Text2 = ""
Text2.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -