📄 form015.frm
字号:
VERSION 5.00
Begin VB.Form Form15
BorderStyle = 1 'Fixed Single
Caption = "请输入您的选择"
ClientHeight = 2970
ClientLeft = 45
ClientTop = 330
ClientWidth = 6345
Icon = "Form015.frx":0000
LinkTopic = "Form15"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2970
ScaleWidth = 6345
StartUpPosition = 2 '屏幕中心
Begin VB.ComboBox Combo10
Height = 300
Left = 4680
TabIndex = 26
Text = "Combo10"
ToolTipText = "结束时"
Top = 1440
Width = 735
End
Begin VB.ComboBox Combo9
Height = 300
Left = 4680
TabIndex = 25
Text = "Combo9"
ToolTipText = "开始时"
Top = 960
Width = 735
End
Begin VB.ComboBox Combo5
Height = 300
Left = 1200
TabIndex = 23
ToolTipText = "站名"
Top = 480
Width = 1455
End
Begin VB.CheckBox Check1
Caption = "无时间限制"
Height = 255
Left = 3240
TabIndex = 22
ToolTipText = "不要开始和结束时间"
Top = 2400
Width = 1215
End
Begin VB.ComboBox Combo8
Height = 300
ItemData = "Form015.frx":0442
Left = 3240
List = "Form015.frx":0444
Style = 2 'Dropdown List
TabIndex = 19
ToolTipText = "结束日"
Top = 1440
Width = 650
End
Begin VB.ComboBox Combo7
Height = 300
ItemData = "Form015.frx":0446
Left = 1800
List = "Form015.frx":0448
Style = 2 'Dropdown List
TabIndex = 18
ToolTipText = "结束月"
Top = 1440
Width = 650
End
Begin VB.ComboBox Combo6
Height = 300
ItemData = "Form015.frx":044A
Left = 480
List = "Form015.frx":044C
Style = 2 'Dropdown List
TabIndex = 17
ToolTipText = "结束年"
Top = 1440
Width = 900
End
Begin VB.ComboBox Combo4
Height = 300
ItemData = "Form015.frx":044E
Left = 3240
List = "Form015.frx":0450
Style = 2 'Dropdown List
TabIndex = 16
ToolTipText = "开始日"
Top = 960
Width = 650
End
Begin VB.ComboBox Combo3
Height = 300
ItemData = "Form015.frx":0452
Left = 1800
List = "Form015.frx":0454
Style = 2 'Dropdown List
TabIndex = 15
ToolTipText = "开始月"
Top = 960
Width = 650
End
Begin VB.ComboBox Combo2
Height = 300
ItemData = "Form015.frx":0456
Left = 480
List = "Form015.frx":0458
Style = 2 'Dropdown List
TabIndex = 14
ToolTipText = "开始年"
Top = 960
Width = 900
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 380
Left = 1800
TabIndex = 12
ToolTipText = "退出查询"
Top = 2400
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 380
Left = 360
TabIndex = 11
ToolTipText = "继续查询"
Top = 2400
Width = 1215
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "Form015.frx":045A
Left = 3840
List = "Form015.frx":045C
TabIndex = 9
Text = "Combo1"
ToolTipText = "站号"
Top = 480
Width = 700
End
Begin VB.OptionButton Option3
Caption = "电压"
Height = 495
Left = 3600
TabIndex = 2
ToolTipText = "中继站电压数据"
Top = 1920
Width = 735
End
Begin VB.OptionButton Option2
Caption = "水位"
Height = 495
Left = 2000
TabIndex = 1
ToolTipText = "水位数据"
Top = 1920
Width = 855
End
Begin VB.OptionButton Option1
Caption = "雨量"
Height = 495
Left = 400
TabIndex = 0
ToolTipText = "雨量数据"
Top = 1920
Value = -1 'True
Width = 735
End
Begin VB.Label Label13
AutoSize = -1 'True
Caption = "时"
Height = 180
Left = 5520
TabIndex = 28
Top = 1560
Width = 180
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "时"
Height = 180
Left = 5520
TabIndex = 27
Top = 1080
Width = 180
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "站名"
Height = 180
Left = 600
TabIndex = 24
Top = 540
Width = 360
End
Begin VB.Label Label12
AutoSize = -1 'True
Caption = "到"
Height = 180
Left = 120
TabIndex = 21
Top = 1560
Width = 180
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "从"
Height = 180
Left = 120
TabIndex = 20
Top = 1080
Width = 180
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "提示:输入选择后,按'确认'键执行查询,按'取消'键放弃查询"
Height = 180
Left = 120
TabIndex = 13
Top = 120
Width = 4770
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "站号"
Height = 180
Left = 3360
TabIndex = 10
Top = 540
Width = 360
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "日"
Height = 180
Left = 4080
TabIndex = 8
Top = 1560
Width = 180
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "月"
Height = 180
Left = 2640
TabIndex = 7
Top = 1560
Width = 180
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "年"
Height = 180
Left = 1440
TabIndex = 6
Top = 1560
Width = 180
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "日"
Height = 180
Left = 4080
TabIndex = 5
Top = 1080
Width = 180
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "月"
Height = 180
Left = 2640
TabIndex = 4
Top = 1080
Width = 180
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "年"
Height = 180
Left = 1440
TabIndex = 3
Top = 1080
Width = 180
End
End
Attribute VB_Name = "Form15"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'
Private Sub Check1_Click()
On Error Resume Next
If Check1.Value = vbChecked Then
Label1.Visible = False
Label2.Visible = False
Label3.Visible = False
Label5.Visible = False
Label6.Visible = False
Label7.Visible = False
Label8.Visible = False
Label11.Visible = False
Label12.Visible = False
Label13.Visible = False
Combo2.Visible = False
Combo3.Visible = False
Combo4.Visible = False
Combo6.Visible = False
Combo7.Visible = False
Combo8.Visible = False
Combo9.Visible = False
Combo10.Visible = False
Else
Label1.Visible = True
Label2.Visible = True
Label3.Visible = True
Label5.Visible = True
Label6.Visible = True
Label7.Visible = True
Label8.Visible = True
Label11.Visible = True
Label12.Visible = True
Label13.Visible = True
Label8.Visible = True
Combo2.Visible = True
Combo3.Visible = True
Combo4.Visible = True
Combo6.Visible = True
Combo7.Visible = True
Combo8.Visible = True
Combo9.Visible = True
Combo10.Visible = True
End If
End Sub
Private Sub Combo1_Click()
Combo5.Text = Name_(CInt(Combo1.Text))
End Sub
Private Sub Combo5_Click()
Dim i As Integer
On Error Resume Next
For i = 1 To 255
If Combo5.Text = Name_(i) Then
Combo1.Text = i
Exit For
End If
Next i
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim d As Boolean
Dim F As Integer
On Error Resume Next
d = False
Call Find_All_Name
For i = 1 To 255
If Not Name_(i) = "" Then
Combo5.AddItem Name_(i)
If Not d Then
F = i
d = True
End If
End If
Next i
For i = 1 To 255
Combo1.AddItem i
Next i
For i = 1 To 12
Combo3.AddItem i
Combo7.AddItem i
Next i
For i = 1 To 31
Combo4.AddItem i
Combo8.AddItem i
Next i
For i = 0 To 23
Combo9.AddItem i
Combo10.AddItem i
Next i
For i = 1995 To 2050
Combo2.AddItem i
Combo6.AddItem i
Next i
Combo2.Text = Year(Now())
Combo6.Text = Year(Now())
Combo3.Text = 1
Combo7.Text = Month(Now())
Combo4.Text = 1
Combo8.Text = day(Now())
Combo5.Text = Combo5.List(0)
Combo9.Text = 0
Combo10.Text = 23
Combo1.Text = F
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
On Error Resume Next
Select Case KeyCode
Case vbKeyReturn '13 ENTER 键
Call Command1_Click
Case Else
End Select
End Sub
Private Sub Command1_Click()
Dim dd As String
Dim Stan_number As Integer
Dim Tim1, Tim2 As Date
Dim T3, T4 As Date
Dim a As New frmdata
On Error Resume Next
Stan_number = CInt(Me.Combo1.Text)
If Me.Option1.Value = True Then
dd = "雨量"
Else
If Me.Option2.Value = True Then
dd = "水位"
Else
dd = "电压"
End If
End If
Tim1 = DateSerial(CInt(Combo2.Text), CInt(Combo3.Text), CInt(Combo4.Text)) + TimeSerial(CInt(Combo9.Text), 0, 0)
Tim2 = DateSerial(CInt(Combo6.Text), CInt(Combo7.Text), CInt(Combo8.Text)) + TimeSerial(CInt(Combo10.Text), 0, 0)
If (Tim1 > Tim2) And (Me.Check1.Value = Unchecked) Then
MsgBox "对不起,日期选择有错误!请重新选择"
Exit Sub
End If
Select Case Kan
Case 1
If Me.Check1.Value = Unchecked Then
sql_string = "SELECT * FROM 原始数据 WHERE 站号 = " & CStr(Stan_number) & _
" AND 时间 >= " & zhong_time_symbol & Format$(Tim1, "YYYY-MM-DD HH:MM:SS") & zhong_time_symbol & _
" AND 时间 <= " & zhong_time_symbol & Format$(Tim2, "YYYY-MM-DD HH:MM:SS") & zhong_time_symbol & _
" AND 物理量 = " & "'" & dd & "'" & _
" ORDER BY 时间 DESC,数值 DESC"
frmdata_caption = CStr(Stan_number) & "号站 " & Name_(Stan_number) & " " & dd & "原始数据" & _
" " & Format$(Tim1, "YYYY-MM-DD HH:MM:SS") & " 到 " & _
Format$(Tim2, "YYYY-MM-DD HH:MM:SS") & _
" 查询"
Else
sql_string = "SELECT * FROM 原始数据 WHERE 站号 = " & CStr(Stan_number) & _
" AND 物理量 = " & "'" & dd & "'" & _
" ORDER BY 时间 DESC,数值 DESC"
frmdata_caption = CStr(Stan_number) & "号站 " & Name_(Stan_number) & " " & dd & "原始数据" & _
" 查询"
End If
Case 2
If Me.Check1.Value = Unchecked Then
sql_string = "SELECT * FROM " & dd & " WHERE 站号 = " & CStr(Stan_number) & _
" AND 时间 >= " & zhong_time_symbol & Format$(Tim1, "YYYY-MM-DD HH:MM:SS") & zhong_time_symbol & _
" AND 时间 <= " & zhong_time_symbol & Format$(Tim2, "YYYY-MM-DD HH:MM:SS") & zhong_time_symbol & _
" ORDER BY 时间 DESC," & dd & " DESC"
frmdata_caption = CStr(Stan_number) & "号站 " & Name_(Stan_number) & " " & dd & "实际数据" & _
" " & Format$(Tim1, "YYYY-MM-DD HH:MM:SS") & " 到 " & _
Format$(Tim2, "YYYY-MM-DD HH:MM:SS") & _
" 查询"
Else
sql_string = "SELECT * FROM " & dd & " WHERE 站号 = " & CStr(Stan_number) & _
" ORDER BY 时间 DESC," & dd & " DESC"
frmdata_caption = CStr(Stan_number) & "号站 " & Name_(Stan_number) & " " & dd & "实际数据" & " 查询"
End If
Case Else
Exit Sub
End Select
a.Show
'Me.Hide
End Sub
Private Sub Command2_Click()
On Error Resume Next
Me.Hide
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -