📄 form1.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 Form2
Caption = "Form2"
ClientHeight = 5625
ClientLeft = 60
ClientTop = 345
ClientWidth = 8760
LinkTopic = "Form2"
ScaleHeight = 5625
ScaleWidth = 8760
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame2
Height = 1335
Left = 120
TabIndex = 12
Top = 4200
Width = 8535
Begin VB.CommandButton Command1
Caption = "添加"
Height = 375
Left = 480
TabIndex = 20
Top = 240
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "删除"
Height = 375
Left = 2520
TabIndex = 19
Top = 240
Width = 1215
End
Begin VB.CommandButton Command3
Caption = "更新"
Height = 375
Left = 4680
TabIndex = 18
Top = 240
Width = 1215
End
Begin VB.CommandButton Command5
Caption = "第一条"
Height = 375
Left = 480
TabIndex = 17
Top = 840
Width = 1215
End
Begin VB.CommandButton Command6
Caption = "前一条"
Height = 375
Left = 2520
TabIndex = 16
Top = 840
Width = 1215
End
Begin VB.CommandButton Command7
Caption = "下一条"
Height = 375
Left = 4680
TabIndex = 15
Top = 840
Width = 1215
End
Begin VB.CommandButton Command8
Caption = "末一条"
Height = 375
Left = 6840
TabIndex = 14
Top = 840
Width = 1215
End
Begin VB.CommandButton Command9
Caption = "退出"
Height = 375
Left = 6840
TabIndex = 13
Top = 240
Width = 1215
End
End
Begin VB.Frame Frame1
Caption = "寝室基本情况表"
Height = 1815
Left = 120
TabIndex = 1
Top = 120
Width = 8535
Begin VB.TextBox Text1
DataField = "寝室号"
DataSource = "Adodc1"
Height = 375
Left = 1200
TabIndex = 6
Top = 600
Width = 1575
End
Begin VB.TextBox Text2
DataField = "寝室名称"
DataSource = "Adodc1"
Height = 375
Left = 4440
TabIndex = 5
Top = 600
Width = 1695
End
Begin VB.TextBox Text3
DataField = "寝室责任人"
DataSource = "Adodc1"
Height = 375
Left = 1200
TabIndex = 4
Top = 1320
Width = 1575
End
Begin VB.TextBox Text4
DataField = "寝室人数"
DataSource = "Adodc1"
Height = 375
Left = 4440
TabIndex = 3
Top = 1320
Width = 1695
End
Begin VB.TextBox Text5
DataField = "公寓号"
DataSource = "Adodc1"
Height = 375
Left = 6720
TabIndex = 2
Top = 1320
Width = 1575
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "寝室号"
Height = 180
Left = 480
TabIndex = 11
Top = 600
Width = 540
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "寝室名称"
Height = 180
Left = 3600
TabIndex = 10
Top = 600
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "寝室责任人"
Height = 180
Left = 240
TabIndex = 9
Top = 1320
Width = 900
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "寝室人数"
Height = 180
Left = 3480
TabIndex = 8
Top = 1320
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "公寓号"
Height = 180
Left = 7200
TabIndex = 7
Top = 600
Width = 540
End
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "Form1.frx":0000
Height = 2055
Left = 120
TabIndex = 0
Top = 2040
Width = 8535
_ExtentX = 15055
_ExtentY = 3625
_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 = 5
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
BeginProperty Column04
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
ColumnWidth = 734.74
EndProperty
BeginProperty Column01
ColumnWidth = 2085.166
EndProperty
BeginProperty Column02
ColumnWidth = 2085.166
EndProperty
BeginProperty Column03
ColumnWidth = 734.74
EndProperty
BeginProperty Column04
ColumnWidth = 734.74
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Adodc1
Height = 495
Left = 2520
Top = 6360
Visible = 0 'False
Width = 2175
_ExtentX = 3836
_ExtentY = 873
ConnectMode = 3
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=D:\xrh\disk1\DOWNLOAD\vb\程序代码\公寓管理\Mydb.mdb"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=D:\xrh\disk1\DOWNLOAD\vb\程序代码\公寓管理\Mydb.mdb"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "room"
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 = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
On Error GoTo adderr
Text1.SetFocus
Adodc1.Recordset.AddNew
Exit Sub
adderr:
MsgBox Err.Description
End Sub
Private Sub Command2_Click()
With Adodc1.Recordset
If Not .EOF And Not .BOF Then
If MsgBox("删除当前记录吗?", vbYesNo + vbQuestion) = vbYes Then
.Delete
.MoveNext
If .EOF Then .MoveLast
End If
End If
End With
End Sub
Private Sub Command3_Click()
On Error GoTo updateerr
Adodc1.Recordset.UpdateBatch
Exit Sub
updateerr:
MsgBox Err.Description
End Sub
Private Sub Command4_Click()
On Error GoTo cancelupdateerr
Adodc1.Recordset.CancelBatch
Exit Sub
cancelupdateerr:
MsgBox Err.Description
End Sub
Private Sub Command5_Click()
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "记录空", vbOKCancel + vbQuestion
End
Else
Adodc1.Recordset.MoveFirst
End If
End Sub
Private Sub Command6_Click()
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF Then
MsgBox "这是第一条记录", vbOKCancel + vbQuestion
Adodc1.Recordset.MoveFirst
End If
End Sub
Private Sub Command7_Click()
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
MsgBox "这是最后一条记录", vbOKCancel + vbQuestion
Adodc1.Recordset.MoveLast
End If
End Sub
Private Sub Command8_Click()
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox "空记录", vbOKCancel + vbQuestion
End
Else
Adodc1.Recordset.MoveLast
End If
End Sub
Private Sub Command9_Click()
caidan.Show
Form2.Hide
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -