?? frmclean.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"
Begin VB.Form frmscore
Caption = "衛生情況記錄"
ClientHeight = 7230
ClientLeft = 60
ClientTop = 450
ClientWidth = 9495
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 7230
ScaleWidth = 9495
Begin MSAdodcLib.Adodc Adodc1
Height = 495
Left = 10080
Top = 2880
Width = 1200
_ExtentX = 2117
_ExtentY = 873
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 VB.Frame Frame2
Caption = "查詢"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 3255
Left = 5160
TabIndex = 3
Top = 3360
Width = 3735
Begin VB.CommandButton Command2
Caption = "查 詢"
Height = 375
Left = 840
TabIndex = 20
Top = 1920
Width = 1095
End
Begin VB.TextBox Text4
Height = 375
Left = 1800
TabIndex = 17
Top = 1080
Width = 735
End
Begin VB.OptionButton Option2
Caption = "按周次:"
Height = 375
Left = 120
TabIndex = 16
Top = 1200
Width = 1095
End
Begin VB.ComboBox Combo2
Height = 300
Left = 1440
TabIndex = 15
Top = 480
Width = 1335
End
Begin VB.OptionButton Option1
Caption = "按宿舍:"
Height = 375
Left = 120
TabIndex = 14
Top = 480
Width = 1095
End
Begin VB.Label Label9
Caption = "周"
Height = 255
Left = 2640
TabIndex = 19
Top = 1200
Width = 255
End
Begin VB.Label Label8
Caption = "第"
Height = 255
Left = 1440
TabIndex = 18
Top = 1200
Width = 255
End
End
Begin VB.Frame Frame1
Caption = "衛生得分錄入"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 3375
Left = 240
TabIndex = 2
Top = 3360
Width = 4575
Begin VB.CommandButton Command3
Caption = "確 定"
Height = 495
Left = 3120
TabIndex = 21
Top = 1080
Width = 1215
End
Begin VB.TextBox Text3
Height = 375
Left = 1320
TabIndex = 11
Top = 2160
Width = 2295
End
Begin VB.TextBox Text2
Height = 375
Left = 1320
TabIndex = 9
Top = 1560
Width = 1335
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1320
TabIndex = 7
Top = 960
Width = 1335
End
Begin VB.TextBox Text1
Height = 375
Left = 1680
TabIndex = 5
Top = 360
Width = 735
End
Begin VB.Label Label7
Caption = "周"
Height = 255
Left = 2520
TabIndex = 13
Top = 480
Width = 255
End
Begin VB.Label Label6
Caption = "第"
Height = 255
Left = 1320
TabIndex = 12
Top = 480
Width = 255
End
Begin VB.Label Label5
Caption = "備注:"
Height = 255
Left = 360
TabIndex = 10
Top = 2280
Width = 735
End
Begin VB.Label Label4
Caption = "得分:"
Height = 255
Left = 360
TabIndex = 8
Top = 1680
Width = 735
End
Begin VB.Label Label3
Caption = "宿舍號:"
Height = 255
Left = 360
TabIndex = 6
Top = 1080
Width = 735
End
Begin VB.Label Label2
Caption = "周次:"
Height = 255
Left = 360
TabIndex = 4
Top = 480
Width = 735
End
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 2175
Left = 240
TabIndex = 0
Top = 960
Width = 8655
_ExtentX = 15266
_ExtentY = 3836
_Version = 393216
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
ColumnCount = 4
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
BeginProperty Column02
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 Column03
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
BeginProperty Column02
EndProperty
BeginProperty Column03
EndProperty
EndProperty
End
Begin VB.Label Label1
Caption = "每周衛生情況"
BeginProperty Font
Name = "隸書"
Size = 26.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 2520
TabIndex = 1
Top = 120
Width = 3615
End
End
Attribute VB_Name = "frmscore"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim con As ADODB.Connection
Private Sub Command2_Click()
'查找記錄
Dim rs As New ADODB.Recordset
Dim query1 As String
If Option1.Value Then
query1 = "SELECT * FROM 衛生得分 WHERE " & "宿舍號" & " = '" & Trim(Combo2.Text) & "'"
End If
If Option2.Value Then
query1 = "SELECT * FROM 衛生得分 WHERE " & "周次" & " = '" & Trim(Text4.Text) & "'"
End If
rs.Open query1, con, adOpenForwardOnly, adLockReadOnly
Set DataGrid1.DataSource = Nothing
If Not (rs.EOF And rs.BOF) Then
rs.MoveFirst
rs.MoveLast
End If
If rs.RecordCount > 0 Then
Set DataGrid1.DataSource = rs
MsgBox "總共查到" & rs.RecordCount & "記錄", vbInformation
'txtteaid.Text = ""
'txtteaname.Text = ""
'txtteaprof.Text = ""
Else
MsgBox "沒有找到記錄,請重新輸入查詢數據", vbInformation
End If
End Sub
Private Sub Command3_Click()
Dim myrs As New ADODB.Recordset
myrs.Open "SELECT * FROM 衛生得分", con, adOpenDynamic, adLockOptimistic, adCmdText
myrs.AddNew
If Text1.Text = Empty Then
MsgBox "周次不能為空!"
Text1.SetFocus
Exit Sub
End If
If Combo1.Text = Empty Then
MsgBox "宿舍號不能為空!"
Text1.SetFocus
Exit Sub
End If
If Text2.Text = Empty Then
MsgBox "請輸入分數!"
Text2.SetFocus
Exit Sub
End If
myrs.Fields(0) = Text1.Text
myrs.Fields(1) = Combo1.Text
myrs.Fields(2) = Text2.Text
myrs.Fields(3) = Text3.Text
myrs.Update '調用Recordset對象Update方法保存數據
' Adodc1.Recordset.Sort = "sno"
Set DataGrid1.DataSource = myrs
' DataGrid1.Refresh
End Sub
Private Sub Form_Load()
'創建連接,并打開
Set con = New ADODB.Connection
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\數據.mdb;Persist Security Info=False"
con.CursorLocation = adUseClient
con.Open
Dim myrs As New ADODB.Recordset
myrs.Open "select * from 衛生得分", con, adOpenForwardOnly, adLockReadOnly
Set DataGrid1.DataSource = myrs
Dim ss As New ADODB.Recordset
Dim query As String
Dim i As Integer
query = "select * from 電量"
ss.Open query, con, 3, 3
If ss.RecordCount > 0 Then
For i = 1 To ss.RecordCount
Combo1.AddItem ss.Fields(0)
Combo2.AddItem ss.Fields(0)
ss.MoveNext
Next
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -