📄 main_csh.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form main_csh
BorderStyle = 1 'Fixed Single
Caption = "初始化"
ClientHeight = 2370
ClientLeft = 2265
ClientTop = 3765
ClientWidth = 7545
Icon = "main_csh.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 2370
ScaleWidth = 7545
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 3360
Top = 2520
Width = 2175
_ExtentX = 3836
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
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 = "kf"
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.CommandButton Comstart
Caption = "开始"
Height = 375
Left = 4035
TabIndex = 7
Top = 1620
Width = 1125
End
Begin VB.CommandButton Comcreat
Caption = "初始化"
Enabled = 0 'False
Height = 375
Left = 5175
TabIndex = 6
Top = 1605
Width = 1125
End
Begin VB.CommandButton Comend
Caption = "退出"
Height = 360
Left = 6300
TabIndex = 5
Top = 1605
Width = 1125
End
Begin MSComctlLib.ProgressBar ProgressBar1
Height = 360
Left = 45
TabIndex = 4
Top = 1635
Visible = 0 'False
Width = 3870
_ExtentX = 6826
_ExtentY = 635
_Version = 393216
Appearance = 1
End
Begin VB.Frame Frame1
Caption = "基础数据"
Enabled = 0 'False
Height = 900
Left = -15
TabIndex = 1
Top = 570
Width = 7455
Begin VB.CheckBox Check3
Caption = "挂账数据"
Height = 240
Left = 4635
TabIndex = 9
Top = 405
Width = 1035
End
Begin VB.CheckBox Check5
Caption = "房态"
Height = 240
Left = 3240
TabIndex = 8
Top = 390
Width = 1230
End
Begin VB.CheckBox Check2
Caption = "退宿结账"
Height = 240
Left = 1800
TabIndex = 3
Top = 390
Width = 1095
End
Begin VB.CheckBox Check1
Caption = "住宿登记"
Height = 240
Left = 420
TabIndex = 2
Top = 375
Width = 1035
End
End
Begin VB.Label Label1
Caption = "提示:初始化,将清空所选表数据或全部数据"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00008000&
Height = 285
Left = 90
TabIndex = 0
Top = 90
Width = 4770
End
End
Attribute VB_Name = "main_csh"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim workarea(200), sql As String '定义字符串变量
Dim rs As ADODB.Recordset
Private Sub Form_Load()
'自动识别数据库路径
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DB_KFGL.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from tb_kf"
Adodc1.Refresh
End Sub
Private Sub Form_Unload(Cancel As Integer)
Main.Enabled = True
End Sub
Private Sub comstart_Click()
Frame1.Enabled = True: Comcreat.Enabled = True
End Sub
Private Sub comcreat_Click() '清空选定表中的数据
A = MsgBox("确认初始化该数据?", 4, "系统提示")
If A = vbYes Then
ProgressBar1.Visible = True 'ProgressBar 控件ProgressBar 控件通过从左到右用一些方块填充矩形来表示一个较长操作的进度。
ProgressBar1.Max = UBound(workarea)
ProgressBar1.Value = ProgressBar1.Min
For Counter = LBound(workarea) To UBound(workarea)
'LBound 函数返回一个 Long 型数据,其值为指定数组维可用的最小下标。
'UBound 函数返回一个 Long 型数据,其值为指定的数组维可用的最大下标。
workarea(Counter) = "initial value " & Counter
ProgressBar1.Value = Counter
If Check1.Value = 1 Then
sql = "delete * from tb_djb"
Set rs = ESQL(sql) '调用模块中的自定义函数
sql = "delete * from tb_djys"
Set rs = ESQL(sql) '调用模块中的自定义函数
End If
If Check2.Value = 1 Then
sql = "delete * from tb_tfd "
Set rs = ESQL(sql) '调用模块中的自定义函数
End If
If Check3.Value = 1 Then
sql = "delete * from tb_gzmx "
Set rs = ESQL(sql) '调用模块中的自定义函数
End If
If Check5.Value = 1 Then
Adodc1.RecordSource = "select * from tb_kf where 房态 ='入住'"
Adodc1.Refresh
'ADO Data 控件ADO Data 控件与内部 Data 控件以及 Remote Data控件 (RDC) 相似。ADO Data 控件使您能使用 Microsoft ActiveX Data Objects (ADO) 快速地创建一个到数据库的连接。
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveFirst
For i = 1 To Adodc1.Recordset.RecordCount
Adodc1.Recordset.Fields("房态") = "空房"
Adodc1.Recordset.Update
If Adodc1.Recordset.EOF = False Then Adodc1.Recordset.MoveNext
Next i
End If
End If
Next Counter
End If
MsgBox "初始化完成!", , "系统提示"
ProgressBar1.Visible = False
ProgressBar1.Value = ProgressBar1.Min
End Sub
Private Sub comend_Click()
Main.Enabled = True
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -