📄 frmweihu.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Frmweihu
Caption = "数据维护"
ClientHeight = 7455
ClientLeft = 60
ClientTop = 345
ClientWidth = 10410
LinkTopic = "Form1"
ScaleHeight = 7455
ScaleWidth = 10410
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "返回"
Height = 495
Left = 8280
TabIndex = 12
Top = 6240
Width = 1215
End
Begin VB.CheckBox Check1
Caption = "进入数据维护状态(可对数据进行添加、删除、修改)"
Height = 495
Left = 7560
TabIndex = 11
Top = 4920
Width = 2655
End
Begin VB.Frame Frame1
Caption = "查询控制"
Height = 3255
Left = 7440
TabIndex = 2
Top = 1200
Width = 2775
Begin VB.CommandButton Command2
Caption = "查询"
Height = 495
Left = 720
TabIndex = 10
Top = 2400
Width = 1335
End
Begin VB.TextBox Time2
Height = 375
Left = 1440
TabIndex = 9
Top = 1680
Width = 1095
End
Begin VB.TextBox Time1
Height = 390
Left = 1440
TabIndex = 8
Top = 1200
Width = 1095
End
Begin VB.ComboBox Combo2
Enabled = 0 'False
Height = 300
ItemData = "Frmweihu.frx":0000
Left = 1080
List = "Frmweihu.frx":000D
TabIndex = 5
Top = 360
Width = 1455
End
Begin VB.ComboBox Combo1
Enabled = 0 'False
Height = 300
Left = 1080
TabIndex = 4
Top = 720
Width = 1455
End
Begin VB.Label Label3
Caption = "输入结束时间"
Height = 255
Left = 240
TabIndex = 7
Top = 1800
Width = 1215
End
Begin VB.Label Label2
Caption = "输入起始时间"
Height = 255
Left = 240
TabIndex = 6
Top = 1320
Width = 1095
End
Begin VB.Label Label1
Caption = "选择查询对象"
Height = 495
Left = 240
TabIndex = 3
Top = 480
Width = 615
End
End
Begin VB.CommandButton Command1
Caption = "加载数据库"
Height = 495
Left = 7680
TabIndex = 1
Top = 360
Width = 2055
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 9480
Top = 7080
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 7440
Top = 7080
Visible = 0 'False
Width = 1695
_ExtentX = 2990
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
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 MSDataGridLib.DataGrid DataGrid1
Bindings = "Frmweihu.frx":0035
Height = 7215
Left = 120
TabIndex = 0
Top = 120
Width = 7095
_ExtentX = 12515
_ExtentY = 12726
_Version = 393216
AllowUpdate = 0 'False
AllowArrows = 0 'False
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
End
Attribute VB_Name = "Frmweihu"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Check1_Click()
Dim i As Integer
Select Case Check1.Value
Case 0
DataGrid1.AllowAddNew = False
DataGrid1.AllowArrows = False
DataGrid1.AllowDelete = False
DataGrid1.AllowUpdate = False
Case 1
i = MsgBox("进入数据维护状态,数据将可更改", 4 + 48, "提示信息")
DataGrid1.AllowAddNew = True
DataGrid1.AllowArrows = True
DataGrid1.AllowDelete = True
DataGrid1.AllowUpdate = True
End Select
End Sub
Private Sub Combo1_Click()
Adodc1.RecordSource = "select * from " & Combo1.Text & ""
Adodc1.Refresh
End Sub
Private Sub Combo2_Click()
If Combo2.Text = "引排水量" Then
Combo1.Clear
Combo1.AddItem "常熟枢纽"
Combo1.AddItem "太浦闸枢纽"
Combo1.AddItem "望亭枢纽"
ElseIf Combo2.Text = "太湖水位" Then
Combo1.Clear
Combo1.AddItem "太湖水位_总表"
Combo1.AddItem "望亭太"
Combo1.AddItem "大浦口"
Combo1.AddItem "西山"
Combo1.AddItem "夹浦"
Combo1.AddItem "小梅口"
Combo1.AddItem "太湖平均"
ElseIf Combo2.Text = "重要站点水雨情" Then
Combo1.Clear
Combo1.AddItem "常州"
Combo1.AddItem "甘露"
Combo1.AddItem "杭长桥"
Combo1.AddItem "嘉兴"
Combo1.AddItem "平望"
Combo1.AddItem "苏州"
Combo1.AddItem "琳桥"
Combo1.AddItem "无锡南门"
End If
End Sub
Private Sub Command2_Click()
Dim ID1 As Integer, ID2 As Integer
If Combo1.Text = "" Then
MsgBox ("请先选择一个测站!")
End If
If Time1.Text = "" Then
MsgBox "请输入起始时间!"
End If
If Time2.Text = "" Then
MsgBox "请输入结束时间!"
End If
If Not Combo1.Text = "" And Not Time1.Text = "" And Not Time2.Text = "" Then
Adodc1.RecordSource = "select * from " & Combo1.Text & " where 日期 >=#" & CDate(Time1.Text) & "# and " & " 日期 <=#" & CDate(Time2.Text) & "#"
Adodc1.Refresh
End If
End Sub
Private Sub Command1_Click()
On Error Resume Next
Dim sfilename As String
Dim str As String
Dim adoConn As ADODB.Connection
Dim adoRt As ADODB.Recordset
Set adoConn = New ADODB.Connection
With CommonDialog1
CommonDialog1.DialogTitle = "open map document"
CommonDialog1.Filter = "table documents(*.mdb)|*.mdb"
CommonDialog1.ShowOpen
If CommonDialog1.FileName = "" Then Exit Sub
sfilename = CommonDialog1.FileName
End With
If sfilename <> "" Then
Combo1.Enabled = True
Combo2.Enabled = True
End If
str = "Provider=Microsoft.Jet.OLEDB.4.0;;Persist Security Info=False;Data Source=" & sfilename
Adodc1.ConnectionString = str
adoConn.ConnectionString = Adodc1.ConnectionString
adoConn.Open
Set adoRt = New ADODB.Recordset
Set adoRt = adoConn.OpenSchema(adSchemaTables)
adoRt.MoveFirst
While Not adoRt.EOF
If adoRt("table_type").Value = "TABLE" Then Combo1.AddItem adoRt("table_name").Value
adoRt.MoveNext
Wend
End Sub
Private Sub Command3_Click()
Unload Me
frmMain.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -