?? roomtype.cls
字號:
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "RoomType"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
'1 TypeId int 客房類型編號
'2 TypeName Varchar 100 客房類型名稱
'3 RoomNum tinyint 房間數(shù)量
'4 Bednum tinyint 床位數(shù)
'5 AirConditioning tinyint 是否有空調(diào)(0 表示沒有,1 表示有)
'6 Tel tinyint 1 是否有電話(0 表示沒有,1 表示有)
'7 Tv tinyint 1 是否有電視(0 有示沒有,1 表示有)
'8 Toilet tinyint 是否有獨立衛(wèi)生間(0 表示沒有,1 表示有)
'9 IceBox tinyint 是否有冰箱(0 表示沒有,1 表示有)
Public TypeId As Long
Public TypeName As String
Public RoomNum As Integer
Public Bednum As Integer
Public AirConditioning As Integer
Public Tel As Integer
Public Tv As Integer
Public Toilet As Integer
Public IceBox As Integer
Public Sub Init()
TypeId = 0
TypeName = ""
RoomNum = ""
Bednum = 0
AirConditioning = 0
Tel = 0
Tv = 0
Toilet = 0
IceBox = 0
End Sub
'刪除RoomType
Public Sub Delete(ByVal TmpId As Long)
SqlStmt = "DELETE FROM RoomType WHERE TypeId=" + Trim(Str(TmpId))
SQLExt (SqlStmt)
End Sub
Public Function In_DB(ByVal TmpTypeName As String) As Boolean
Dim rs As New ADODB.Recordset
SqlStmt = "SELECT TypeId FROM RoomType WHERE TypeName='" _
+ Trim(TmpTypeName) + "'"
Set rs = QueryExt(SqlStmt)
If rs.EOF = True Then
In_DB = False
Else
In_DB = True
End If
End Function
Public Sub Insert()
SqlStmt = "INSERT INTO RoomType VALUES( '" _
+ Trim(TypeName) + "'," + Trim(RoomNum) + "," + Trim(Bednum) _
+ "," + Trim(AirConditioning) + "," + Trim(Tel) _
+ "," + Trim(Tv) + "," + Trim(Toilet) + "," + Trim(IceBox) + ")"
SQLExt (SqlStmt)
End Sub
Public Sub Loadtype()
Dim rs As New ADODB.Recordset
Dim i As Integer
i = 0
'對數(shù)組進行初始化
Erase Arr_RoomType
ReDim Arr_RoomType(0)
Erase Arr_TypeId
ReDim Arr_TypeId(0)
'設(shè)置SQL語句,使用DISTINCT關(guān)鍵字避免出現(xiàn)重復(fù)的客戶類別,結(jié)果集按TypeName字段排序
SqlStmt = "SELECT TypeId, TypeName FROM RoomType ORDER BY TypeName"
'執(zhí)行SQL語句,將返回結(jié)果集賦值到rs對象中
Set rs = QueryExt(SqlStmt)
'依次把讀取的數(shù)據(jù)賦值到數(shù)組中
Do Until rs.EOF = True
ReDim Preserve Arr_TypeId(i + 1)
Arr_TypeId(i) = rs.Fields(0)
ReDim Preserve Arr_RoomType(i + 1)
Arr_RoomType(i) = rs.Fields(1)
'將指針移動到下一條記錄
i = i + 1
rs.MoveNext
Loop
End Sub
'更新數(shù)據(jù)
Public Sub Update(ByVal TmpId As Long)
SqlStmt = "UPDATE RoomType SET TypeName='" + Trim(TypeName) _
+ "',RoomNum=" + Trim(RoomNum) + ", Bednum=" _
+ Trim(Bednum) + ", AirConditioning=" + Trim(AirConditioning) _
+ ", Tel=" + Trim(Tel) + ", Tv=" + Trim(Tv) + ", Toilet=" _
+ Trim(Toilet) + ", IceBox=" + Trim(IceBox) + " Where TypeId = " _
+ Trim(Str(TmpId))
SQLExt (SqlStmt)
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -