📄 学生上机情况.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 = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form Form6
Caption = "学生上机情况"
ClientHeight = 7560
ClientLeft = 165
ClientTop = 555
ClientWidth = 10515
LinkTopic = "Form6"
ScaleHeight = 7560
ScaleWidth = 10515
StartUpPosition = 2 '屏幕中心
Visible = 0 'False
Begin VB.Frame Frame1
Caption = "查询区"
Height = 2055
Left = 1320
TabIndex = 1
Top = 5280
Width = 7575
Begin VB.CheckBox Check3
Caption = "Check3"
Height = 255
Left = 960
TabIndex = 11
Top = 1560
Width = 255
End
Begin VB.CheckBox Check2
Caption = "Check2"
Height = 255
Left = 960
TabIndex = 10
Top = 960
Width = 255
End
Begin VB.CheckBox Check1
Caption = "Check1"
Height = 255
Left = 960
TabIndex = 9
Top = 360
Width = 255
End
Begin MSComCtl2.DTPicker DTPicker1
BeginProperty DataFormat
Type = 1
Format = "yyyy-MM-dd"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 3
EndProperty
Height = 375
Left = 2160
TabIndex = 8
Top = 840
Width = 2775
_ExtentX = 4895
_ExtentY = 661
_Version = 393216
Format = 21299201
CurrentDate = 39230
End
Begin VB.TextBox maskedbox1
Height = 375
Left = 2160
TabIndex = 5
Top = 1440
Width = 2775
End
Begin VB.CommandButton Command3
Caption = "查 询"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 5520
TabIndex = 4
Top = 480
Width = 1455
End
Begin VB.TextBox Text1
Height = 375
Left = 2160
TabIndex = 2
Top = 240
Width = 2775
End
Begin VB.Label Label3
Caption = "IP地址"
Height = 375
Left = 1320
TabIndex = 7
Top = 1560
Width = 615
End
Begin VB.Label Label2
Caption = "时间"
Height = 255
Left = 1440
TabIndex = 6
Top = 960
Width = 495
End
Begin VB.Label 学号
Caption = " 学号"
Height = 375
Left = 1320
TabIndex = 3
Top = 360
Width = 495
End
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "学生上机情况.frx":0000
Height = 4575
Left = 600
TabIndex = 0
Top = 360
Width = 9255
_ExtentX = 16325
_ExtentY = 8070
_Version = 393216
AllowArrows = 0 'False
HeadLines = 1
RowHeight = 15
FormatLocked = -1 'True
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
Caption = "学生上机情况使用表"
ColumnCount = 4
BeginProperty Column00
DataField = "no"
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 = "used_start"
Caption = "开始使用时间"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = "yyyy-MM-dd"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column02
DataField = "used_end"
Caption = "结束使用时间"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = "yyyy-MM-dd"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column03
DataField = "IP"
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
ColumnWidth = 1275.024
EndProperty
BeginProperty Column01
ColumnWidth = 2085.166
EndProperty
BeginProperty Column02
ColumnWidth = 2085.166
EndProperty
BeginProperty Column03
ColumnWidth = 1544.882
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 7200
Top = 4560
Width = 2655
_ExtentX = 4683
_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 = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=student;Data Source=127.0.0.1"
OLEDBString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=student;Data Source=127.0.0.1"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from used_rec"
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.Menu return
Caption = "返回"
End
Begin VB.Menu print
Caption = "打印"
Begin VB.Menu output
Caption = "输出到excel表格"
End
End
End
Attribute VB_Name = "Form6"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'
'Dim exlapp As New Excel.Application
'Dim exlbook As Excel.Workbook
'Dim exlsheet As Excel.Worksheet
'Dim mybd As Database
'Dim rs As Recordset
Option Explicit
Dim i, j, k As Integer
Dim strConn As String
Dim pubConn As New ADODB.Connection
Dim rsTable As New ADODB.Recordset
Dim strSQL As String
Dim xlapp As Variant
Dim xlBook As Variant
Dim xlSheet As Variant
Private Sub Command3_Click()
Dim dd As String
dd = DTPicker1.Value
Dim sql As String
sql = "select * from used_rec"
If Check1.Value = Unchecked And Check2.Value = Unchecked And Check3.Value = Unchecked Then MsgBox "请选择查询条件!", vbInformation, "提示信息"
If Check1.Value = Checked And Text1.Text <> "" And Check2.Value = Unchecked And Check3.Value = Unchecked Then sql = sql & " where no = " & Trim(Text1.Text)
If Check1.Value = Checked And Text1.Text <> "" And Check2.Value = Checked And Check3.Value = Unchecked Then sql = sql & " where no = " & Trim(Text1.Text) & " and datediff(day,used_start," & "'" & dd & "'" & ")=0"
If Check1.Value = Checked And Text1.Text <> "" And Check2.Value = Checked And Check3.Value = Checked Then sql = sql & " where no = " & Trim(Text1.Text) & " and datediff(day,used_start," & "'" & dd & "'" & ")=0 " & " and ip = '" & maskedbox1.Text & "'"
If Check1.Value = Checked And Text1.Text <> "" And Check2.Value = Unchecked And Check3.Value = Checked Then sql = sql & " where no = " & Trim(Text1.Text) & " and ip = '" & maskedbox1.Text & "'"
If Check1.Value = Unchecked And Check2.Value = Checked And Check3.Value = Checked Then sql = sql & " where datediff(day,used_start," & "'" & dd & "'" & ")=0 " & " and ip = '" & maskedbox1.Text & "'"
If Check1.Value = Unchecked And Check2.Value = Unchecked And Check3.Value = Checked Then sql = sql & " where IP = '" & maskedbox1.Text & "'"
If Check1.Value = Unchecked And Check2.Value = Checked And Check3.Value = Unchecked Then sql = sql & " where datediff(day,used_start," & "'" & dd & "'" & ")=0 "
Adodc1.RecordSource = sql
Adodc1.Refresh
DataGrid1.Refresh
End Sub
Private Sub output_Click()
Set xlapp = CreateObject("excel.application")
Set xlBook = xlapp.Workbooks.add
Set xlSheet = xlBook.Worksheets(1)
xlapp.Visible = True
On Error Resume Next
If Err.Number <> 0 Then
Set xlapp = CreateObject("Excel.Application")
Set xlBook = xlapp.Workbooks.add
Set xlSheet = xlBook.ActiveSheet
End If
For k = 1 To DataGrid1.Columns.Count
xlSheet.Cells(1, k) = DataGrid1.Columns(k - 1).Caption
Next k
xlSheet.Columns(1).ColumnWidth = 10
xlSheet.Columns(2).ColumnWidth = 22
xlSheet.Columns(2).NumberFormatLocal = "yyyy-Mm-Dd Hh:Mm:Ss"
xlSheet.Columns(3).ColumnWidth = 22
xlSheet.Columns(4).ColumnWidth = 20
For i = 1 To Adodc1.Recordset.RecordCount + 1
For j = 0 To DataGrid1.Columns.Count
xlSheet.Cells(i + 1, j + 1) = Adodc1.Recordset(j)
Next j
Adodc1.Recordset.MoveNext
Next i
End Sub
Private Sub return_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -