📄 form1.frm
字号:
Top = 840
Width = 1455
End
Begin VB.TextBox Text1
Height = 270
Left = 1080
TabIndex = 1
Text = "Text1"
Top = 360
Width = 1455
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "IP地址:"
Height = 180
Left = 240
TabIndex = 6
Top = 1320
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "截止日期:"
Height = 180
Left = 120
TabIndex = 4
Top = 840
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "起始日期:"
Height = 180
Left = 120
TabIndex = 2
Top = 360
Width = 900
End
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 120
Top = 5400
Width = 2775
_ExtentX = 4895
_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
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim SourceDbfName As String
Dim ObjectDbfName As String
Dim CurDate As Date
Dim ZPath As String
Dim ZName As String
Private Sub Command1_Click()
Dim lsStr As String
Dim lsStr1 As String
Dim lsPos As Integer
Set DataGrid1.DataSource = Nothing
lsPos = InStr(1, Text1.Text, "-")
If lsPos > 1 Then
lsStr = Left(Text1.Text, lsPos - 1)
lsStr1 = Right(Text1.Text, Len(Text1.Text) - lsPos)
End If
ZPath = lsStr
lsPos = InStr(1, lsStr1, "-")
If lsPos > 1 Then
lsStr = Left(lsStr1, lsPos - 1)
lsStr1 = Right(lsStr1, Len(lsStr1) - lsPos)
End If
ZPath = ZPath + lsStr
ZName = ZPath + lsStr1
SourceDbfName = SourcePath + ZPath + "\tlclc" + ZName + ".mdb"
If Dir(SourceDbfName) <> "" Then
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + SourceDbfName + ";Persist Security Info=False"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from log where src_ip='" + Text3.Text + "' order by start_date+start_time"
Adodc1.Refresh
Adodc1.Recordset.Requery
Adodc1.Caption = Adodc1.Recordset.RecordCount
Adodc1.Refresh
DataGrid1.ClearFields
Set DataGrid1.DataSource = Adodc1
DataGrid1.Refresh
End If
End Sub
Private Sub Command3_Click()
Dim lsStr As String
Dim lsStr1 As String
Dim lsPos As Integer
Set DataGrid1.DataSource = Nothing
lsPos = InStr(1, Text1.Text, "-")
If lsPos > 1 Then
lsStr = Left(Text1.Text, lsPos - 1)
lsStr1 = Right(Text1.Text, Len(Text1.Text) - lsPos)
End If
ZPath = lsStr
lsPos = InStr(1, lsStr1, "-")
If lsPos > 1 Then
lsStr = Left(lsStr1, lsPos - 1)
lsStr1 = Right(lsStr1, Len(lsStr1) - lsPos)
End If
ZPath = ZPath + lsStr
ZName = ZPath + lsStr1
SourceDbfName = SourcePath + ZPath + "\tlclc" + ZName + ".mdb"
If Dir(SourceDbfName) <> "" Then
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + SourceDbfName + ";Persist Security Info=False"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from log order by start_date+start_time"
Adodc1.Refresh
Adodc1.Recordset.Requery
Adodc1.Caption = Adodc1.Recordset.RecordCount
Adodc1.Refresh
DataGrid1.ClearFields
Set DataGrid1.DataSource = Adodc1
DataGrid1.Refresh
End If
End Sub
Private Sub Command4_Click()
Unload Me
End
End Sub
Private Sub Command5_Click()
Dim lsStr As String
Dim lsStr1 As String
Dim lsPos As Integer
Set DataGrid1.DataSource = Nothing
lsPos = InStr(1, Text1.Text, "-")
If lsPos > 1 Then
lsStr = Left(Text1.Text, lsPos - 1)
lsStr1 = Right(Text1.Text, Len(Text1.Text) - lsPos)
End If
ZPath = lsStr
lsPos = InStr(1, lsStr1, "-")
If lsPos > 1 Then
lsStr = Left(lsStr1, lsPos - 1)
lsStr1 = Right(lsStr1, Len(lsStr1) - lsPos)
End If
ZPath = ZPath + lsStr
ZName = ZPath + lsStr1
SourceDbfName = SourcePath + ZPath + "\tlclc" + ZName + ".mdb"
If Dir(SourceDbfName) <> "" Then
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + SourceDbfName + ";Persist Security Info=False"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from log where left(dst_ip," + CStr(Len(Trim(Text4.Text))) + ")='" + Text4.Text + "' order by start_date+start_time"
Adodc1.Refresh
Adodc1.Recordset.Requery
Adodc1.Caption = Adodc1.Recordset.RecordCount
Adodc1.Refresh
DataGrid1.ClearFields
Set DataGrid1.DataSource = Adodc1
DataGrid1.Refresh
End If
End Sub
Private Sub DataGrid1_DblClick()
Dim Z_Message As String
MsgBox Adodc1.Recordset.Fields("src_ip").Value
Z_Message = Adodc1.Recordset.Fields("src_ip").Value + " 这是一个测试!" + vbLf + vbCr
Z_Message = Z_Message + "你在" + CStr(Adodc1.Recordset.Fields("start_time").Value)
Z_Message = Z_Message + "访问过" + Adodc1.Recordset.Fields("dst_ip").Value + "站点!"
Shell "net send " + Z_Message
End Sub
Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
If Not (Adodc1.Recordset.BOF Or Adodc1.Recordset.EOF) Then
Adodc1.Caption = CStr(Adodc1.Recordset.Bookmark) + "/" + CStr(Adodc1.Recordset.RecordCount)
End If
End Sub
Private Sub Form_Load()
Set DataGrid1.DataSource = Nothing
CurDate = Date
Text1.Text = CStr(Year(CurDate))
ZPath = Text1.Text
If Month(CurDate) < 10 Then
Text1.Text = Text1.Text + "-0" + CStr(Month(CurDate))
ZPath = ZPath + "0" + CStr(Month(CurDate))
Else
Text1.Text = Text1.Text + "-" + CStr(Month(CurDate))
ZPath = ZPath + CStr(Month(CurDate))
End If
ZName = ZPath
If Day(CurDate) < 10 Then
Text1.Text = Text1.Text + "-0" + CStr(Day(CurDate))
ZName = ZName + "0" + CStr(Day(CurDate))
Else
Text1.Text = Text1.Text + "-" + CStr(Day(CurDate))
ZName = ZName + CStr(Day(CurDate))
End If
SourceDbfName = SourcePath + ZPath + "\tlclc" + ZName + ".mdb"
Text2.Text = Text1.Text
Text3.Text = ""
Text4.Text = ""
If Dir(SourceDbfName) <> "" Then
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + SourceDbfName + ";Persist Security Info=False"
Adodc1.CommandType = adCmdTable
Adodc1.RecordSource = "log"
Adodc1.Refresh
Adodc1.Caption = Adodc1.Recordset.RecordCount
'Adodc1.Recordset.Requery
DataGrid1.ClearFields
Set DataGrid1.DataSource = Adodc1
DataGrid1.Refresh
End If
End Sub
Private Sub Form_Resize()
Frame1.Left = 80
Frame2.Left = 80
Frame3.Left = 80
Adodc1.Left = 80
Command3.Left = 80
Command4.Left = Frame1.Width - Command4.Width + 80
Frame1.Top = (Form1.ScaleHeight - Frame1.Height - 80 - Frame2.Height - 80 - Frame3.Height - 80 - Adodc1.Height - 80 - Command3.Height) / 2
Frame2.Top = Frame1.Top + Frame1.Height + 80
Frame3.Top = Frame2.Top + Frame2.Height + 80
Adodc1.Top = Frame3.Top + Frame3.Height + 80
Command3.Top = Adodc1.Top + Adodc1.Height + 80
Command4.Top = Command3.Top
DataGrid1.Top = 80
DataGrid1.Left = Frame1.Width + 160
If Form1.ScaleWidth - Frame1.Width - 260 > 0 Then
DataGrid1.Width = Form1.ScaleWidth - Frame1.Width - 240
End If
If Form1.ScaleHeight > 180 Then
DataGrid1.Height = Form1.ScaleHeight - 160
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -