dbhouse.vb
来自「Visual Basic 2005数据库通用模块开发与系统移植 物业管理信息系统」· VB 代码 · 共 154 行
VB
154 行
Class DBHouse
Inherits DBOperation
Private _HouseNo As String
Private _HouseType As String
Private _Building As String
Private _Unit As String
Private _Room As String
Private _ConstructArea As Double
Private _UsingArea As Double
Private _LiverID As String
Private _Name As String
Private _Phone As String
Private _Memo As String
Property HouseNo() As String
Get
Return _HouseNo
End Get
Set(ByVal value As String)
_HouseNo = value
End Set
End Property
Property HouseType() As String
Get
Return _HouseType
End Get
Set(ByVal value As String)
_HouseType = value
End Set
End Property
Property Building() As String
Get
Return _Building
End Get
Set(ByVal value As String)
_Building = value
End Set
End Property
Property Unit() As String
Get
Return _Unit
End Get
Set(ByVal value As String)
_Unit = value
End Set
End Property
Property Room() As String
Get
Return _Room
End Get
Set(ByVal value As String)
_Room = value
End Set
End Property
Property ConstructArea() As String
Get
Return _ConstructArea
End Get
Set(ByVal value As String)
_ConstructArea = value
End Set
End Property
Property UsingArea() As String
Get
Return _UsingArea
End Get
Set(ByVal value As String)
_UsingArea = value
End Set
End Property
Property LiverID() As String
Get
Return _LiverID
End Get
Set(ByVal value As String)
_LiverID = value
End Set
End Property
Property Name() As String
Get
Return _Name
End Get
Set(ByVal value As String)
_Name = value
End Set
End Property
Property Phone() As String
Get
Return _Phone
End Get
Set(ByVal value As String)
_Phone = value
End Set
End Property
Property Memo() As String
Get
Return _Memo
End Get
Set(ByVal value As String)
_Memo = value
End Set
End Property
Sub AddHouse()
Dim SQLString As String
SQLString = "SELECT * FROM tbHouse WHERE HouseNo='" & HouseNo & "'"
Dim MSG As String
Dim UserTable As DataTable = DBOperation.DBOperate(SQLString, MSG)
If UserTable.Rows.Count >= 1 Then '判断用户是否存在
MsgBox("该房屋的编号已存在,请重试", MsgBoxStyle.Exclamation, "信息框")
Else
SQLString = "INSERT INTO tbHouse VALUES('" & HouseNo & "','"
SQLString += HouseType & "','" & Building & "','"
SQLString += Unit & "','" & Room & "','"
SQLString += ConstructArea & "','" & UsingArea & "','"
SQLString += LiverID & "','" & Name & "','"
SQLString += Phone & "','" & Now.Date & "','"
SQLString += Memo & "')"
DBOperate(SQLString, MSG)
' MsgBox(MSG, MsgBoxStyle.Exclamation, "信息框")
End If
End Sub
Shared Sub DelHouse(ByVal HouseNo As String)
Dim SQLString As String
Dim MSG As String
SQLString = "DELETE FROM tbHouse WHERE HouseNo ='" & HouseNo & "'"
DBOperate(SQLString, MSG)
End Sub
Shared Function LoadHouse(ByVal Field As String, ByVal Value As String, ByVal DBOperator As String) As DataTable
Dim SQLString As String
Dim MSG As String
Dim Column As String = ""
Column += "HouseNo AS 房屋编号, HouseType AS 房屋类型,"
Column += "Building AS 楼号, Unit AS 单元号,"
Column += "Room AS 房间号, ConstructArea AS 建筑面积,"
Column += "UsingArea AS 使用面积, LiverID AS 业主身份证号,"
Column += "Name AS 业主姓名, Phone AS 联系电话,"
Column += "CreateDate AS 信息修改日期, Memo AS 备注"
If Field = "" Then
SQLString = "SELECT " & Column & " FROM tbHouse"
ElseIf DBOperator = "" Then
SQLString = "SELECT " & Column & " FROM tbHouse WHERE " & Field & "= '" & Value & "'"
ElseIf DBOperator = "LIKE" Then
SQLString = "SELECT " & Column & " FROM tbHouse WHERE " & Field & " " & DBOperator & "'" & Value & "%" & "'"
End If
Return DBOperate(SQLString, MSG)
End Function
End Class
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?