小区物业管理系统-数据库交互

小区物业管理系统-数据库交互

UserDao 用户登录数据库交互

Imports System.Data.SqlClient
Imports System.Data.OleDb

'模块:UserDao
'作用:用户登录数据库交互
'@author:CaoPengCheng
Module UserDao
    Dim conn As String = sqlconn()
    Dim conn2 As String = sqlconn2()
    '方法:userSelectUsername();
    '作用:用于查询三个登录用户是否存在
    '参数:(username,table)
    '返回值:用户名是否存在于表中(int),1存在,否在不存在
    Public Function userSelectUsername(user As User)

        Dim f As Integer
        Try
            Dim objconn As New SqlConnection(conn2)
            Dim strsql1 As String = "select count(*) from " & user.tableGet() & "  where username='" & user.usernameGet() & "'"
            objconn.Open()
            Dim objcmd As New SqlCommand(strsql1, objconn)
            f = objcmd.ExecuteScalar
            objconn.Close()
            objcmd.Dispose()
        Catch ex As Exception
            MsgBox("userServletUsername" + ex.Message)
        End Try

        If (f > 0) Then
            Return 1
        Else
            Return 0
        End If
    End Function
    '方法:userSelectPassworld();
    '作用:用于三个登录用户的不同表的密码判断
    '参数:(username,table)
    '返回值:1密码正确
    Public Function userSelectPassworld(user As User)

        Dim f As Integer
        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象
            Dim strsql As String = "select password from " & user.tableGet() & " where username='" & user.usernameGet() & "'"
            objAdap = New OleDbDataAdapter(strsql, conn)
            objDataSet.Reset() '清除数据集
            objAdap.Fill(objDataSet, "User") '第二个参数就是给这个虚拟表起个名字
            f = objDataSet.Tables("User").Rows(0).Item(0)
        Catch ex As Exception
            MsgBox("userServletPassworld" + ex.Message)
        End Try

        If (Int(user.passwordGet()) = f) Then
            Return 1
        Else
            Return 0
        End If
    End Function
    '方法:userSelect();
    '作用:用户表数据查询
    '参数:(username,table)
    '返回值:user
    Public Function userSelect(username As String, table As String)
        Dim user As New User()

        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象

            Dim strsql As String = "select username,password from " & table & " where username='" & username & "'"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            'MsgBox("1")
            objDataSet.Reset() '清除数据集
            'MsgBox("2")
            objAdap.Fill(objDataSet, "User") '第二个参数就是给这个虚拟表起个名字
            'MsgBox("3")
            user.usernameSet(Trim(objDataSet.Tables("User").Rows(0).Item(0)))
            user.passwordSet(Trim(objDataSet.Tables("User").Rows(0).Item(1)))
        Catch ex As Exception
            MsgBox("userSelect:" + ex.Message)
        End Try
        Return user
    End Function
    '方法:userUpdata();
    '作用:用户密码修改
    '参数:(user)
    Public Function userUpdata(user As User)
        ' MsgBox(user.tableGet())
        'MsgBox(user.passwordGet())
        'MsgBox(user.usernameGet())
        Try
            Dim strsql As String = "update " & user.tableGet() & " set password ='" & user.passwordGet() & "' where username ='" & user.usernameGet() & "'"
            Dim objconn As New SqlConnection(conn2)
            Dim objcmd As New SqlCommand(strsql, objconn)

            objconn.Open()
            objcmd.ExecuteNonQuery()

            MsgBox("修改成功!")

            objconn.Close()
        Catch ex As Exception
            MsgBox("userUpdata:" + ex.Message)
        End Try
        Return user
    End Function
    '方法:userInsert();
    '作用:用户密码修改
    '参数:(user)
    Public Function userInsert(user As User)
        Try
            Dim strsql As String = "insert " & user.tableGet() & " values ('" & user.usernameGet() & "',123);"
            Dim objconn As New SqlConnection(conn2)
            Dim objcmd As New SqlCommand(strsql, objconn)

            objconn.Open()
            objcmd.ExecuteNonQuery()

            'MsgBox("成功!")

            objconn.Close()
        Catch ex As Exception
            MsgBox("userInsert:" + ex.Message)
        End Try
        Return user
    End Function
    '方法:UserDelete();
    '作用:业主信息删除
    '参数:(proprietor)

    Public Sub UserDelete(pno As String)
        Try
            Dim strsql As String = "delete from User_Proprietor where username='" & pno & "'"
            Dim objconn As New SqlConnection(conn2)
            Dim objcmd As New SqlCommand(strsql, objconn)

            objconn.Open()
            objcmd.ExecuteNonQuery()
            'MsgBox("删除成功")
            objconn.Close()
        Catch ex As Exception
            MsgBox("UserDelete:" + ex.Message)
        End Try

    End Sub
    '方法:UserDeletePropetyManager();
    '作用:业主信息删除
    '参数:(proprietor)

    Public Sub UserDeletePropetyManager(pno As String)
        Try
            Dim strsql As String = "delete from User_PropetyManager where username='" & pno & "'"
            Dim objconn As New SqlConnection(conn2)
            Dim objcmd As New SqlCommand(strsql, objconn)

            objconn.Open()
            objcmd.ExecuteNonQuery()
            'MsgBox("删除成功")
            objconn.Close()
        Catch ex As Exception
            MsgBox("UserDelete:" + ex.Message)
        End Try

    End Sub
End Module

ProprietorDao 业主数据库交互

Imports System.Data.OleDb
Imports System.Data.SqlClient

'模块:ProprietorDao
'作用:业主数据库交互
'@author:CaoPengCheng
Module ProprietorDao
    Dim conn As String = sqlconn()
    Dim conn2 As String = sqlconn2()
    '方法:ProprietorSelect();
    '作用:业主信息查询
    '参数:(pno)
    Public Function ProprietorSelect(pno As String)
        Dim proprietor As New Proprietor
        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象
            Dim strsql As String = "select * from Proprietor where Pno ='" & pno & "'"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            objDataSet.Reset() '清除数据集
            objAdap.Fill(objDataSet, "Pro") '第二个参数就是给这个虚拟表起个名字

            ' For i = 0 To 7
            'MsgBox(objDataSet.Tables("Pro").Rows(0).Item(i))
            'Next
            proprietor.pnoSet(objDataSet.Tables("Pro").Rows(0).Item(0))
            proprietor.pnameSet(objDataSet.Tables("Pro").Rows(0).Item(1))
            proprietor.p_bnoSet(objDataSet.Tables("Pro").Rows(0).Item(2))
            proprietor.p_gnoSet(objDataSet.Tables("Pro").Rows(0).Item(3))
            proprietor.psexSet(objDataSet.Tables("Pro").Rows(0).Item(4))
            proprietor.pageSet(objDataSet.Tables("Pro").Rows(0).Item(5))
            proprietor.pnativeSet(objDataSet.Tables("Pro").Rows(0).Item(6))
            Return proprietor
        Catch ex As Exception
            MsgBox("ProprietorSelect" + ex.Message)
        End Try
        Return 0
    End Function

    '方法:proprietorUpdata();
    '作用:业主信息修改
    '参数:(proprietor)

    Public Sub proprietorUpdata(proprietor As Proprietor)
        Try
            ' MsgBox(proprietor.pnameGet)
            ' MsgBox(proprietor.psexGet)
            'MsgBox(proprietor.pageGet)
            'MsgBox(proprietor.pnativeGet)
            ' MsgBox("pno=" + proprietor.pnoGet)
            Dim strsql As String = "update Proprietor set Pname='" & proprietor.pnameGet & "',Psex='" & proprietor.psexGet & "',Page='" & proprietor.pageGet & "',Pnative='" & proprietor.pnativeGet & "',P_Bno='" & proprietor.p_bnoGet & "',P_Gno='" & proprietor.p_gnoGet & "' where Pno='" & proprietor.pnoGet & "'"
            Dim objconn As New SqlConnection(conn2)
            Dim objcmd As New SqlCommand(strsql, objconn)

            objconn.Open()
            objcmd.ExecuteNonQuery()

            MsgBox("修改成功!")

            objconn.Close()
        Catch ex As Exception
            MsgBox("proprietorUpdata:" + ex.Message)
        End Try

    End Sub
    '方法:proprietorSelectCount();
    '作用:业主信息存在查询
    '参数:(proprietor)
    Public Function proprietorSelectCount(pno As String)
        Dim f As Integer
        Try
            Dim objconn As New SqlConnection(conn2)
            Dim strsql1 As String = "select count(*) from Proprietor  where Pno='" & pno & "' or Pname ='" & pno & "'"
            objconn.Open()
            Dim objcmd As New SqlCommand(strsql1, objconn)
            f = objcmd.ExecuteScalar
            objconn.Close()
            objcmd.Dispose()
        Catch ex As Exception
            MsgBox("proprietorSelectCount" + ex.Message)
        End Try

        Return f
    End Function
    '方法:proprietorCount();
    '作用:业主个数
    '参数:(proprietor)
    Public Function proprietorCount()
        Dim f As Integer
        Try
            Dim objconn As New SqlConnection(conn2)
            Dim strsql1 As String = "select count(*) from Proprietor"
            objconn.Open()
            Dim objcmd As New SqlCommand(strsql1, objconn)
            f = objcmd.ExecuteScalar
            objconn.Close()
            objcmd.Dispose()
        Catch ex As Exception
            MsgBox("proprietorCount" + ex.Message)
        End Try

        Return f
    End Function
    '方法:ProprietorSelectForPnoName();
    '作用:业主信息查询
    '参数:(pno)
    Public Function ProprietorSelectForPnoName(pnoandName As String)
        Dim proprietor As New Proprietor
        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象
            Dim strsql As String = "select * from Proprietor where Pno ='" & pnoandName & "' or Pname ='" & pnoandName & "'"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            objDataSet.Reset() '清除数据集
            objAdap.Fill(objDataSet, "Pro") '第二个参数就是给这个虚拟表起个名字

            ' For i = 0 To 7
            'MsgBox(objDataSet.Tables("Pro").Rows(0).Item(i))
            'Next

            proprietor.pnoSet(objDataSet.Tables("Pro").Rows(0).Item(0))
            proprietor.pnameSet(objDataSet.Tables("Pro").Rows(0).Item(1))
            proprietor.p_bnoSet(objDataSet.Tables("Pro").Rows(0).Item(2))
            proprietor.p_gnoSet(objDataSet.Tables("Pro").Rows(0).Item(3))
            proprietor.psexSet(objDataSet.Tables("Pro").Rows(0).Item(4))
            proprietor.pageSet(objDataSet.Tables("Pro").Rows(0).Item(5))
            proprietor.pnativeSet(objDataSet.Tables("Pro").Rows(0).Item(6))
            Return proprietor
        Catch ex As Exception
            MsgBox("ProprietorSelectForPnoName" + ex.Message)
        End Try
        Return 0
    End Function
    '方法:proprietorInsert();
    '作用:业主信息修改
    '参数:(proprietor)

    Public Sub proprietorInsert(proprietor As Proprietor)
        Try
            Dim strsql As String = "insert into Proprietor values ('" & proprietor.pnoGet & "','" & proprietor.pnameGet & "','" & proprietor.p_bnoGet & "','" & proprietor.p_gnoGet & "','" & proprietor.psexGet & "'," & proprietor.pageGet & ",'" & proprietor.pnativeGet & "')"
            Dim objconn As New SqlConnection(conn2)
            Dim objcmd As New SqlCommand(strsql, objconn)

            objconn.Open()
            objcmd.ExecuteNonQuery()
            'MsgBox("Success")
            objconn.Close()
        Catch ex As Exception
            MsgBox("proprietorInsert:" + ex.Message)
        End Try

    End Sub
    '方法:proprietorDelete();
    '作用:业主信息删除
    '参数:(proprietor)

    Public Sub proprietorDelete(pno As String)
        Try
            Dim strsql As String = "delete from Proprietor where Pno='" & pno & "'"
            Dim objconn As New SqlConnection(conn2)
            Dim objcmd As New SqlCommand(strsql, objconn)

            objconn.Open()
            objcmd.ExecuteNonQuery()
            'MsgBox("删除成功")
            objconn.Close()
        Catch ex As Exception
            MsgBox("proprietorDelete:" + ex.Message)
        End Try
    End Sub
    '方法:ProprietorSelectLike();
    '作用:业主信息模糊查询
    '参数:(pno)
    Public Function ProprietorSelectLike(pnoandName As String)
        Dim pro(100) As Proprietor
        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象
            Dim strsql As String = "select * from Proprietor where Pno like '" & pnoandName & "%' or Pname like '" & pnoandName & "%'"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            objDataSet.Reset() '清除数据集
            objAdap.Fill(objDataSet, "Pro") '第二个参数就是给这个虚拟表起个名字

            ' For i = 0 To 7
            'MsgBox(objDataSet.Tables("Pro").Rows(0).Item(i))
            'Next
            For i = 0 To Int(objDataSet.Tables("Pro").Rows.Count) - 1
                Dim proprietor As New Proprietor
                proprietor.pnoSet(objDataSet.Tables("Pro").Rows(i).Item(0))
                proprietor.pnameSet(objDataSet.Tables("Pro").Rows(i).Item(1))
                proprietor.p_bnoSet(objDataSet.Tables("Pro").Rows(i).Item(2))
                proprietor.p_gnoSet(objDataSet.Tables("Pro").Rows(i).Item(3))
                proprietor.psexSet(objDataSet.Tables("Pro").Rows(i).Item(4))
                proprietor.pageSet(objDataSet.Tables("Pro").Rows(i).Item(5))
                proprietor.pnativeSet(objDataSet.Tables("Pro").Rows(i).Item(6))
                pro(i + 1) = proprietor
            Next



        Catch ex As Exception
            MsgBox("ProprietorSelectForPnoName" + ex.Message)
        End Try
        Return pro
    End Function
    '方法:proprietorCountLike();
    '作用:业主个数
    '参数:(proprietor)
    Public Function proprietorCountLike(pnoandName As String)
        Dim f As Integer
        Try
            Dim objconn As New SqlConnection(conn2)
            Dim strsql1 As String = "select count(*) from Proprietor where Pno like '" & pnoandName & "%' or Pname like '" & pnoandName & "%'"
            objconn.Open()
            Dim objcmd As New SqlCommand(strsql1, objconn)
            f = objcmd.ExecuteScalar
            objconn.Close()
            objcmd.Dispose()
        Catch ex As Exception
            MsgBox("proprietorCount" + ex.Message)
        End Try

        Return f
    End Function
End Module

ProprietorDao 管理人员数据库交互

Imports System.Data.OleDb
Imports System.Data.SqlClient

'模块:ProprietorDao
'作用:管理人员数据库交互
'@author:CaoPengCheng
Module PropertyManagementDao
    Dim conn As String = sqlconn()
    Dim conn2 As String = sqlconn2()

    '方法:PropertyManagementSelectLike();
    '作用:业主信息模糊查询
    '参数:(pno)
    Public Function PropertyManagementSelectLike(wnoandName As String)
        Dim pro(100) As PropetyManager
        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象
            Dim strsql As String = "select * from PropetyManager where PMno like '" & wnoandName & "%' or PMname like '" & wnoandName & "%'"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            objDataSet.Reset() '清除数据集
            objAdap.Fill(objDataSet, "Pro") '第二个参数就是给这个虚拟表起个名字

            ' For i = 0 To 7
            'MsgBox(objDataSet.Tables("Pro").Rows(0).Item(i))
            'Next
            For i = 0 To Int(objDataSet.Tables("Pro").Rows.Count) - 1
                Dim proprietor As New PropetyManager

                proprietor.pmnoSet(objDataSet.Tables("Pro").Rows(i).Item(0))
                proprietor.pmnameSet(objDataSet.Tables("Pro").Rows(i).Item(1))
                proprietor.pmsexSet(objDataSet.Tables("Pro").Rows(i).Item(2))
                proprietor.pmageSet(objDataSet.Tables("Pro").Rows(i).Item(3))
                proprietor.pmeduSet(objDataSet.Tables("Pro").Rows(i).Item(4))
                proprietor.pmnativeSet(objDataSet.Tables("Pro").Rows(i).Item(5))
                proprietor.pmdeptSet(objDataSet.Tables("Pro").Rows(i).Item(6))
                proprietor.pm_leaderSet(objDataSet.Tables("Pro").Rows(i).Item(7))
                pro(i + 1) = proprietor
            Next



        Catch ex As Exception
            MsgBox("PropertyManagementSelectLike" + ex.Message)
        End Try
        Return pro
    End Function
    '方法:PropertyManagementCountLike();
    '作用:业主个数
    '参数:(proprietor)
    Public Function PropertyManagementCountLike(wnoandName As String)
        Dim f As Integer
        Try
            Dim objconn As New SqlConnection(conn2)
            Dim strsql1 As String = "select count(*) from PropetyManager where PMno like '" & wnoandName & "%' or PMname like '" & wnoandName & "%'"
            objconn.Open()
            Dim objcmd As New SqlCommand(strsql1, objconn)
            f = objcmd.ExecuteScalar
            objconn.Close()
            objcmd.Dispose()
        Catch ex As Exception
            MsgBox("PropertyManagementCountLike" + ex.Message)
        End Try

        Return f
    End Function
    '方法:PropertyManagementSelect();
    '作用:业主信息查询
    '参数:(pno)
    Public Function PropertyManagementSelect(wnoandName As String)
        Dim proprietor As New PropetyManager

        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象
            Dim strsql As String = "select * from PropetyManager where PMno= '" & wnoandName & "'"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            objDataSet.Reset() '清除数据集
            objAdap.Fill(objDataSet, "Pro") '第二个参数就是给这个虚拟表起个名字

            ' For i = 0 To 7
            'MsgBox(objDataSet.Tables("Pro").Rows(0).Item(i))
            'Next


            proprietor.pmnoSet(objDataSet.Tables("Pro").Rows(0).Item(0))
            proprietor.pmnameSet(objDataSet.Tables("Pro").Rows(0).Item(1))
            proprietor.pmsexSet(objDataSet.Tables("Pro").Rows(0).Item(2))
            proprietor.pmageSet(objDataSet.Tables("Pro").Rows(0).Item(3))
            proprietor.pmeduSet(objDataSet.Tables("Pro").Rows(0).Item(4))
            proprietor.pmnativeSet(objDataSet.Tables("Pro").Rows(0).Item(5))
            proprietor.pmdeptSet(objDataSet.Tables("Pro").Rows(0).Item(6))
            proprietor.pm_leaderSet(objDataSet.Tables("Pro").Rows(0).Item(7))




        Catch ex As Exception
            MsgBox("PropertyManagementSelectLike" + ex.Message)
        End Try
        Return proprietor
    End Function
    '方法:PropertyManagementDelete();
    '作用:业主信息删除
    '参数:(proprietor)

    Public Sub PropertyManagementDelete(pno As String)
        Try
            Dim strsql As String = "delete from PropetyManager where PMno='" & pno & "'"
            Dim objconn As New SqlConnection(conn2)
            Dim objcmd As New SqlCommand(strsql, objconn)

            objconn.Open()
            objcmd.ExecuteNonQuery()
            'MsgBox("删除成功")
            objconn.Close()
        Catch ex As Exception
            MsgBox("PropertyManagementDelete:" + ex.Message)
        End Try

    End Sub
    '方法:PropertyManagementDelete();
    '作用:业主信息删除
    '参数:(proprietor)

    Public Sub PropertyManagementUpdata(pm As PropetyManager)
        Try
            Dim strsql As String = "update PropetyManager set PMname ='" & pm.pmnameGet & "',PMage =" & pm.pmageGet & ",PMsex ='" & pm.pmsexGet & "',PMdept='" & pm.pmdeptGet & "',PMedu ='" & pm.pmeduGet & "',PMnative ='" & pm.pmnativeGet & "',PM_Leader ='" & pm.pm_leaderGet & "' where PMno ='" & pm.pmnoGet & "'"
            Dim objconn As New SqlConnection(conn2)
            Dim objcmd As New SqlCommand(strsql, objconn)

            objconn.Open()
            objcmd.ExecuteNonQuery()
            'MsgBox("删除成功")
            objconn.Close()
        Catch ex As Exception
            MsgBox("PropertyManagementUpdata:" + ex.Message)
        End Try

    End Sub
  
    '方法:PropertyManagementSelectForDept();
    '作用:业主信息模糊查询
    '参数:(pno)
    Public Function PropertyManagementSelectForDept()
        Dim pro(100) As PropetyManager
        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象
            Dim strsql As String = "select * from PropetyManager where PMdept='经理'"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            objDataSet.Reset() '清除数据集
            objAdap.Fill(objDataSet, "Pro") '第二个参数就是给这个虚拟表起个名字

            ' For i = 0 To 7
            'MsgBox(objDataSet.Tables("Pro").Rows(0).Item(i))
            'Next
            For i = 0 To Int(objDataSet.Tables("Pro").Rows.Count) - 1
                Dim proprietor As New PropetyManager

                proprietor.pmnoSet(objDataSet.Tables("Pro").Rows(i).Item(0))
                proprietor.pmnameSet(objDataSet.Tables("Pro").Rows(i).Item(1))
                proprietor.pmsexSet(objDataSet.Tables("Pro").Rows(i).Item(2))
                proprietor.pmageSet(objDataSet.Tables("Pro").Rows(i).Item(3))
                proprietor.pmeduSet(objDataSet.Tables("Pro").Rows(i).Item(4))
                proprietor.pmnativeSet(objDataSet.Tables("Pro").Rows(i).Item(5))
                proprietor.pmdeptSet(objDataSet.Tables("Pro").Rows(i).Item(6))
                proprietor.pm_leaderSet(objDataSet.Tables("Pro").Rows(i).Item(7))
                pro(i + 1) = proprietor
            Next
        Catch ex As Exception
            MsgBox("PropertyManagementSelectLike" + ex.Message)
        End Try
        Return pro
    End Function
    '方法:PropertyManagementCountJL();
    '作用:业主个数
    '参数:(proprietor)
    Public Function PropertyManagementCountJL()
        Dim f As Integer
        Try
            Dim objconn As New SqlConnection(conn2)
            Dim strsql1 As String = "select count(*) from PropetyManager where PMdept='经理'"
            objconn.Open()
            Dim objcmd As New SqlCommand(strsql1, objconn)
            f = objcmd.ExecuteScalar
            objconn.Close()
            objcmd.Dispose()
        Catch ex As Exception
            MsgBox("PropertyManagementCountJL" + ex.Message)
        End Try

        Return f
    End Function
    '方法:PropertyManagementSelectWno();
    '作用:业主信息模糊查询
    '参数:(pno)
    Public Function PropertyManagementSelectWno(wnoandName As String)

        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象
            Dim strsql As String = "select PMno from PropetyManager where  PMname='" & wnoandName & "'"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            objDataSet.Reset() '清除数据集
            objAdap.Fill(objDataSet, "Pro") '第二个参数就是给这个虚拟表起个名字
            Return objDataSet.Tables("Pro").Rows(0).Item(0)

        Catch ex As Exception
            MsgBox("PropertyManagementSelectLike" + ex.Message)
        End Try
        Return 0
    End Function


    '方法:PropertyManagementSelectforAll();
    '作用:业主信息模糊查询
    '参数:(pno)
    Public Function PropertyManagementSelectforAll()
        Dim pro(100) As PropetyManager
        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象
            Dim strsql As String = "select * from PropetyManager"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            objDataSet.Reset() '清除数据集
            objAdap.Fill(objDataSet, "Pro") '第二个参数就是给这个虚拟表起个名字

            ' For i = 0 To 7
            'MsgBox(objDataSet.Tables("Pro").Rows(0).Item(i))
            'Next
            For i = 0 To Int(objDataSet.Tables("Pro").Rows.Count) - 1
                Dim proprietor As New PropetyManager

                proprietor.pmnoSet(objDataSet.Tables("Pro").Rows(i).Item(0))
                proprietor.pmnameSet(objDataSet.Tables("Pro").Rows(i).Item(1))
                proprietor.pmsexSet(objDataSet.Tables("Pro").Rows(i).Item(2))
                proprietor.pmageSet(objDataSet.Tables("Pro").Rows(i).Item(3))
                proprietor.pmeduSet(objDataSet.Tables("Pro").Rows(i).Item(4))
                proprietor.pmnativeSet(objDataSet.Tables("Pro").Rows(i).Item(5))
                proprietor.pmdeptSet(objDataSet.Tables("Pro").Rows(i).Item(6))
                proprietor.pm_leaderSet(objDataSet.Tables("Pro").Rows(i).Item(7))
                pro(i + 1) = proprietor
            Next



        Catch ex As Exception
            MsgBox("PropertyManagementSelectforAll" + ex.Message)
        End Try
        Return pro
    End Function
    '方法:PropertyManagementSelectforAllCount();
    '作用:业主个数
    '参数:(proprietor)
    Public Function PropertyManagementSelectforAllCount()
        Dim f As Integer
        Try
            Dim objconn As New SqlConnection(conn2)
            Dim strsql1 As String = "select count(*) from PropetyManager"
            objconn.Open()
            Dim objcmd As New SqlCommand(strsql1, objconn)
            f = objcmd.ExecuteScalar
            objconn.Close()
            objcmd.Dispose()
        Catch ex As Exception
            MsgBox("PropertyManagementSelectforAllCount" + ex.Message)
        End Try
        Return f
    End Function
    '方法:PropertyManagementInsert();
    '作用:业主信息删除
    '参数:(proprietor)

    Public Sub PropertyManagementInsert(pm As PropetyManager)
        Try
            Dim strsql As String = "insert into PropetyManager values ('" & pm.pmnoGet & "','" & pm.pmnameGet & "','" & pm.pmsexGet & "'," & pm.pmageGet & ",'" & pm.pmeduGet & "','" & pm.pmnativeGet & "','" & pm.pmdeptGet & "','" & pm.pm_leaderGet & "')"
            Dim objconn As New SqlConnection(conn2)
            Dim objcmd As New SqlCommand(strsql, objconn)

            objconn.Open()
            objcmd.ExecuteNonQuery()
            'MsgBox("删除成功")
            objconn.Close()
        Catch ex As Exception
            MsgBox("PropertyManagementInsert:" + ex.Message)
        End Try

    End Sub
End Module

GarageDao 车库数据库交互

Imports System.Data.OleDb
Imports System.Data.SqlClient

'模块:GarageDao
'作用:车库数据库交互
'@author:CaoPengCheng
Module GarageDao
    Dim conn As String = sqlconn()
    Dim conn2 As String = sqlconn2()

    '方法:GarageSelect();
    '作用:车库信息查询
    '参数:(gno)
    Public Function GarageSelect()
        Dim ga(1000) As Garage
        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象
            Dim strsql As String = "select * from Garage"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            objDataSet.Reset() '清除数据集
            objAdap.Fill(objDataSet, "Gar") '第二个参数就是给这个虚拟表起个名字

            For i = 0 To objDataSet.Tables("Gar").Rows.Count - 1
                Dim garage As New Garage
                garage.gnoSet(objDataSet.Tables("Gar").Rows(i).Item(1))
                garage.gaddressSet(objDataSet.Tables("Gar").Rows(i).Item(1))
            Next

        Catch ex As Exception
            MsgBox("GarageSelect" + ex.Message)
        End Try
        Return ga
    End Function
    '方法:GarageSelectByGno();
    '作用:车库信息查询
    '参数:(gno)
    Public Function GarageSelectByGno(gno As String)
        Dim garage As New Garage
        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象
            Dim strsql As String = "select * from Garage where Gno ='" & gno & "'"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            objDataSet.Reset() '清除数据集
            objAdap.Fill(objDataSet, "Gar") '第二个参数就是给这个虚拟表起个名字

            garage.gnoSet(gno)
            garage.gaddressSet(objDataSet.Tables("Gar").Rows(0).Item(1))


            Return garage
        Catch ex As Exception
            MsgBox("GarageSelectByGno" + ex.Message)
        End Try
        Return 0
    End Function
    '方法:GarageSelectGaddress();
    '作用:车库信息查询View_Garage_NO
    '参数:(gno)
    Public Function GarageSelectGaddress()
        Dim s(100) As String
        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象
            Dim strsql As String = "select Gaddress from View_Garage_NO"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            objDataSet.Reset() '清除数据集
            objAdap.Fill(objDataSet, "Gar") '第二个参数就是给这个虚拟表起个名字

            s(0) = Int(objDataSet.Tables("Gar").Rows.Count)
            For i = 0 To Int(objDataSet.Tables("Gar").Rows.Count) - 1
                s(i + 1) = objDataSet.Tables("Gar").Rows(i).Item(0)
            Next
        Catch ex As Exception
            MsgBox("GarageSelectGaddress" + ex.Message)
        End Try
        Return s
    End Function
    '方法:GarageSelectGno();
    '作用:车库信息查询
    '参数:(gno)
    Public Function GarageSelectGno(address As String)
        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象
            Dim strsql As String = "select Gno from Garage where Gaddress='" & address & "'"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            objDataSet.Reset() '清除数据集
            objAdap.Fill(objDataSet, "Gar") '第二个参数就是给这个虚拟表起个名字

            Return objDataSet.Tables("Gar").Rows(0).Item(0)
        Catch ex As Exception
            MsgBox("GarageSelectGaddress" + ex.Message)
        End Try
        Return 0
    End Function

    '方法:GarageSelectLike();
    '作用:车库信息查询
    '参数:(gno)
    Public Function GarageSelectLike(bno As String)
        Dim b(1000) As Garage
        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象
            Dim strsql As String = "select * from View_Garage_NO where Gno like'" & bno & "%' or Gaddress like '" & bno & "%'"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            objDataSet.Reset() '清除数据集
            objAdap.Fill(objDataSet, "Bui") '第二个参数就是给这个虚拟表起个名字

            For i = 0 To objDataSet.Tables("Bui").Rows.Count - 1
                Dim building As New Garage
                building.gnoSet(objDataSet.Tables("Bui").Rows(i).Item(0))
                building.gaddressSet(objDataSet.Tables("Bui").Rows(i).Item(1))

                b(i + 1) = building
            Next

        Catch ex As Exception
            MsgBox("GarageSelectLike" + ex.Message)
        End Try
        Return b
    End Function


    '方法:GarageSelectLikeCount();
    '作用:业主个数
    '参数:(proprietor)
    Public Function GarageSelectLikeCount(bno As String)
        Dim f As Integer
        Try
            Dim objconn As New SqlConnection(conn2)
            Dim strsql1 As String = "select count(*) from View_Garage_NO where Gno like'" & bno & "%' or Gaddress like '" & bno & "%'"
            objconn.Open()
            Dim objcmd As New SqlCommand(strsql1, objconn)
            f = objcmd.ExecuteScalar
            objconn.Close()
            objcmd.Dispose()
            'MsgBox(f)
        Catch ex As Exception
            MsgBox("GarageSelectLikeCount" + ex.Message)
        End Try
        Return f
    End Function

    '方法:GarageSelectCount();
    '作用:业主个数
    '参数:(proprietor)
    Public Function GarageSelectCount()
        Dim f As Integer
        Try
            Dim objconn As New SqlConnection(conn2)
            Dim strsql1 As String = "select count(*) from Garage"
            objconn.Open()
            Dim objcmd As New SqlCommand(strsql1, objconn)
            f = objcmd.ExecuteScalar
            objconn.Close()
            objcmd.Dispose()
            'MsgBox(f)
        Catch ex As Exception
            MsgBox("GarageSelectCount" + ex.Message)
        End Try
        Return f
    End Function

    '方法:GarageDelete();
    '作用:缴费
    '参数:(str As String, pno As String, bno As String, number As Double)
    Public Sub GarageDelete(pno As String)
        Try
            Dim strsql As String = "delete from Garage where Gno ='" & pno & "'"
            Dim objconn As New SqlConnection(conn2)
            Dim objcmd As New SqlCommand(strsql, objconn)

            objconn.Open()
            objcmd.ExecuteNonQuery()

            ' MsgBox("修改成功!")

            objconn.Close()
        Catch ex As Exception
            MsgBox("GarageDelete:" + ex.Message)
        End Try
    End Sub

    '方法:GarageInsert();
    '作用:缴费
    '参数:(str As String, pno As String, bno As String, number As Double)
    Public Sub GarageInsert(pno As Garage)
        Try
            Dim strsql As String = "insert into Garage values ('" & pno.gnoGet & "','" & pno.gaddressGet & "')"
            Dim objconn As New SqlConnection(conn2)
            Dim objcmd As New SqlCommand(strsql, objconn)

            objconn.Open()
            objcmd.ExecuteNonQuery()

            ' MsgBox("修改成功!")

            objconn.Close()
        Catch ex As Exception
            MsgBox("GarageInsert:" + ex.Message)
        End Try
    End Sub
End Module

CostDao 缴费数据库交互

Imports System.Data.OleDb
Imports System.Data.SqlClient

'模块:CostDao
'作用:缴费数据库交互
'@author:CaoPengCheng
Module CostDao
    Dim conn As String = sqlconn()
    Dim conn2 As String = sqlconn2()

    '方法:costSelect();
    '作用:查询对应用户的费用数据
    '参数:(pno,bno)
    '返回值:缴费抽象对象
    Public Function costSelect(pno As String)
        Dim cost As New Cost()

        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象

            Dim strsql As String = "select Cwater,Celectricity,Cgas,Cproperty,C_Bno   from Cost where C_Pno ='" & pno & "'"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            'MsgBox("1")
            objDataSet.Reset() '清除数据集
            'MsgBox("2")
            objAdap.Fill(objDataSet, "Cost") '第二个参数就是给这个虚拟表起个名字
            'MsgBox("3")
            cost.c_pnoSet(pno)
            ' cost.c_bnoSet(bno)
            cost.cwaterSet(objDataSet.Tables("Cost").Rows(0).Item(0))
            cost.celectricitySet(objDataSet.Tables("Cost").Rows(0).Item(1))
            cost.cgasSet(objDataSet.Tables("Cost").Rows(0).Item(2))
            cost.cpropertySet(objDataSet.Tables("Cost").Rows(0).Item(3))
            cost.c_bnoSet(objDataSet.Tables("Cost").Rows(0).Item(4))

        Catch ex As Exception
            MsgBox("costSelect:" + ex.Message)
        End Try
        Return cost
    End Function

    '方法:costUpdata();
    '作用:缴费
    '参数:(str As String, pno As String, bno As String, number As Double)
    Public Sub costUpdata(str As String, pno As String, number As Double)
        Try
            Dim strsql As String = "update Cost set " & str & " = " & number & "  where C_Pno ='" & pno & "'"
            Dim objconn As New SqlConnection(conn2)
            Dim objcmd As New SqlCommand(strsql, objconn)

            objconn.Open()
            objcmd.ExecuteNonQuery()

            ' MsgBox("修改成功!")

            objconn.Close()
        Catch ex As Exception
            MsgBox("costUpdata:" + ex.Message)
        End Try
    End Sub
    '方法:costInsert();
    '作用:缴费
    '参数:(str As String, pno As String, bno As String, number As Double)
    Public Sub costInsert(pno As String, bno As String)
        Try
            Dim strsql As String = "insert into Cost values ('" & pno & "','" & bno & "',0,0,0,0)"
            Dim objconn As New SqlConnection(conn2)
            Dim objcmd As New SqlCommand(strsql, objconn)

            objconn.Open()
            objcmd.ExecuteNonQuery()

            ' MsgBox("修改成功!")

            objconn.Close()
        Catch ex As Exception
            MsgBox("costInsert:" + ex.Message)
        End Try
    End Sub
    '方法:costDelete();
    '作用:缴费
    '参数:(str As String, pno As String, bno As String, number As Double)
    Public Sub costDelete(pno As String)
        Try
            Dim strsql As String = "delete from Cost where C_Pno ='" & pno & "'"
            Dim objconn As New SqlConnection(conn2)
            Dim objcmd As New SqlCommand(strsql, objconn)

            objconn.Open()
            objcmd.ExecuteNonQuery()

            ' MsgBox("修改成功!")

            objconn.Close()
        Catch ex As Exception
            MsgBox("costDelete:" + ex.Message)
        End Try
    End Sub
    '方法:costSelectAll();
    '作用:查询对应用户的费用数据
    '参数:(pno,bno)
    '返回值:缴费抽象对象
    Public Sub costSelectAll()


        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象
            Dim i As Integer
            Dim strsql As String = "select Cwater,Celectricity,Cgas,Cproperty,C_Bno,C_Pno from Cost"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            objDataSet.Reset() '清除数据集
            objAdap.Fill(objDataSet, "Cost") '第二个参数就是给这个虚拟表起个名字

            For i = 0 To Int(objDataSet.Tables("Cost").Rows.Count) - 1
                costUpdata("Cwater", objDataSet.Tables("Cost").Rows(i).Item(5), CDbl(Str(objDataSet.Tables("Cost").Rows(i).Item(0))) - 20)
                costUpdata("Celectricity", objDataSet.Tables("Cost").Rows(i).Item(5), CDbl(Str(objDataSet.Tables("Cost").Rows(i).Item(1))) - 30)
                costUpdata("Cgas", objDataSet.Tables("Cost").Rows(i).Item(5), CDbl(Str(objDataSet.Tables("Cost").Rows(i).Item(2))) - 40)
                costUpdata("Cproperty", objDataSet.Tables("Cost").Rows(i).Item(5), CDbl(Str(objDataSet.Tables("Cost").Rows(i).Item(3))) - 50)
            Next

        Catch ex As Exception
            MsgBox("costSelectAll:" + ex.Message)
        End Try
    End Sub
    '方法:costSelectCount();
    '作用:用于查询三个登录用户是否存在
    '参数:(username,table)
    '返回值:用户名是否存在于表中(int),1存在,否在不存在
    Public Function costSelectCount(pno As String)

        Dim f As Integer
        Try
            Dim objconn As New SqlConnection(conn2)
            Dim strsql1 As String = "select count(*) from  Cost where C_Pno='" & pno & "'"
            objconn.Open()
            Dim objcmd As New SqlCommand(strsql1, objconn)
            f = objcmd.ExecuteScalar
            objconn.Close()
            objcmd.Dispose()
        Catch ex As Exception
            MsgBox("costSelectCount" + ex.Message)
        End Try

        If (f > 0) Then
            Return 1
        Else
            Return 0
        End If
    End Function
End Module

BuildingDao 楼房数据库交互

Imports System.Data.OleDb
Imports System.Data.SqlClient

'模块:BuildingDao
'作用:楼房数据库交互
'@author:CaoPengCheng
Module BuildingDao
    Dim conn As String = sqlconn()
    Dim conn2 As String = sqlconn2()

    '方法:BuildingSelectByBno();
    '作用:车库信息查询
    '参数:(gno)
    Public Function BuildingSelectByBno(bno As String)
        Dim building As New Building
        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象
            Dim strsql As String = "select * from Building where Bno ='" & bno & "'"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            objDataSet.Reset() '清除数据集
            objAdap.Fill(objDataSet, "Bui") '第二个参数就是给这个虚拟表起个名字

            building.bnoSet(bno)
            building.bareaSet(objDataSet.Tables("Bui").Rows(0).Item(1))
            building.blounoSet(objDataSet.Tables("Bui").Rows(0).Item(2))
            building.bapartmentSet(objDataSet.Tables("Bui").Rows(0).Item(3))
            building.broomnoSet(objDataSet.Tables("Bui").Rows(0).Item(4))

            Return building
        Catch ex As Exception
            MsgBox("BuildingSelectByBno" + ex.Message)
        End Try
        Return 0
    End Function
    '方法:BuildingSelectForBarea();
    '作用:车库信息查询View_Building_NO
    Public Function BuildingSelectForBarea()
        Dim s(100) As String
        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象
            Dim strsql As String = "select distinct Barea from View_Building_NO"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            objDataSet.Reset() '清除数据集
            objAdap.Fill(objDataSet, "Bui") '第二个参数就是给这个虚拟表起个名字

            'MsgBox(objDataSet.Tables("Bui").Rows(0).Item(0))
            'MsgBox(objDataSet.Tables("Bui").Rows(1).Item(0))
            ' MsgBox(objDataSet.Tables("Bui").Rows.Count)
            's(0)存储个数
            s(0) = objDataSet.Tables("Bui").Rows.Count
            For i = 0 To Int(objDataSet.Tables("Bui").Rows.Count) - 1
                s(i + 1) = objDataSet.Tables("Bui").Rows(i).Item(0)
            Next

            'MsgBox(s(1))
            ' MsgBox(s(2))
        Catch ex As Exception
            MsgBox("BuildingSelectForBarea" + ex.Message)
        End Try
        Return s
    End Function
    '方法:BuildingSelectForBlouno();
    '作用:车库信息查询View_Building_NO
    Public Function BuildingSelectForBlouno(barea As String)
        Dim s(100) As String
        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象
            Dim strsql As String = "select distinct Blouno from View_Building_NO where Barea='" & barea & "'"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            objDataSet.Reset() '清除数据集
            objAdap.Fill(objDataSet, "Bui") '第二个参数就是给这个虚拟表起个名字
            's(0)存储个数
            s(0) = objDataSet.Tables("Bui").Rows.Count
            For i = 0 To Int(objDataSet.Tables("Bui").Rows.Count) - 1
                s(i + 1) = objDataSet.Tables("Bui").Rows(i).Item(0)
            Next
        Catch ex As Exception
            MsgBox("BuildingSelectForBarea" + ex.Message)
        End Try
        Return s
    End Function
    '方法:BuildingSelectForBapartment();
    '作用:车库信息查询View_Building_NO
    Public Function BuildingSelectForBapartment(barea As String, blouno As String)
        Dim s(100) As String
        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象
            Dim strsql As String = "select distinct Bapartment from View_Building_NO where Barea='" & barea & "' and Blouno='" & blouno & "'"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            objDataSet.Reset() '清除数据集
            objAdap.Fill(objDataSet, "Bui") '第二个参数就是给这个虚拟表起个名字
            s(0) = objDataSet.Tables("Bui").Rows.Count
            For i = 0 To Int(objDataSet.Tables("Bui").Rows.Count) - 1
                s(i + 1) = objDataSet.Tables("Bui").Rows(i).Item(0)
            Next
        Catch ex As Exception
            MsgBox("BuildingSelectForBarea" + ex.Message)
        End Try
        Return s
    End Function
    '方法:BuildingSelectForBRoomNo();
    '作用:车库信息查询View_Building_NO
    Public Function BuildingSelectForBRoomNo(barea As String, blouno As String, bapartment As String)
        Dim s(100) As String
        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象
            Dim strsql As String = "select distinct BRoomNo from View_Building_NO where Barea='" & barea & "' and Blouno='" & blouno & "' and Bapartment='" & bapartment & "'"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            objDataSet.Reset() '清除数据集
            objAdap.Fill(objDataSet, "Bui") '第二个参数就是给这个虚拟表起个名字
            s(0) = objDataSet.Tables("Bui").Rows.Count
            For i = 0 To Int(objDataSet.Tables("Bui").Rows.Count) - 1
                'MsgBox(objDataSet.Tables("Bui").Rows(i).Item(0))
                s(i + 1) = objDataSet.Tables("Bui").Rows(i).Item(0)
            Next
        Catch ex As Exception
            MsgBox("BuildingSelectForBarea" + ex.Message)
        End Try
        Return s
    End Function
    '方法:BuildingSelectForBno();
    '作用:车库信息查询
    Public Function BuildingSelectForBno(barea As String, blouno As String, bapartment As String, bRoomNo As String)
        Dim s(100) As String
        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象
            Dim strsql As String = "select Bno from Building where Barea='" & barea & "' and Blouno='" & blouno & "' and Bapartment='" & bapartment & "' and BRoomNo='" & bRoomNo & "'"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            objDataSet.Reset() '清除数据集
            objAdap.Fill(objDataSet, "Bui") '第二个参数就是给这个虚拟表起个名字
            Return objDataSet.Tables("Bui").Rows(0).Item(0)
        Catch ex As Exception
            MsgBox("BuildingSelectForBno" + ex.Message)
        End Try
        Return 0
    End Function


    '方法:BuildingSelectLike();
    '作用:车库信息查询
    '参数:(gno)
    Public Function BuildingSelectLike(bno As String)
        Dim b(1000) As Building
        Try
            Dim objconn As New OleDbConnection(conn) '创建连接对象
            Dim objAdap As OleDbDataAdapter '创建适配对象
            Dim objDataSet As New DataSet '创建数据集对象
            Dim strsql As String = "select * from View_Building_NO where Bno like'" & bno & "%'"

            objAdap = New OleDbDataAdapter(strsql, objconn)
            objDataSet.Reset() '清除数据集
            objAdap.Fill(objDataSet, "Bui") '第二个参数就是给这个虚拟表起个名字

            For i = 0 To objDataSet.Tables("Bui").Rows.Count - 1
                Dim building As New Building
                building.bnoSet(objDataSet.Tables("Bui").Rows(i).Item(0))
                building.bareaSet(objDataSet.Tables("Bui").Rows(i).Item(1))
                building.blounoSet(objDataSet.Tables("Bui").Rows(i).Item(2))
                building.bapartmentSet(objDataSet.Tables("Bui").Rows(i).Item(3))
                building.broomnoSet(objDataSet.Tables("Bui").Rows(i).Item(4))
                b(i + 1) = building
            Next
           
        Catch ex As Exception
            MsgBox("BuildingSelectLike" + ex.Message)
        End Try
        Return b
    End Function

 
    '方法:BuildingSelectCount();
    '作用:业主个数
    '参数:(proprietor)
    Public Function BuildingSelectCount(bno As String)
        Dim f As Integer
        Try
            Dim objconn As New SqlConnection(conn2)
            Dim strsql1 As String = "select count(*) from View_Building_NO where Bno like'" & bno & "%'"
            objconn.Open()
            Dim objcmd As New SqlCommand(strsql1, objconn)
            f = objcmd.ExecuteScalar
            objconn.Close()
            objcmd.Dispose()
            'MsgBox(f)
        Catch ex As Exception
            MsgBox("BuildingSelectCount" + ex.Message)
        End Try
        Return f
    End Function

    '方法:BuiDelete();
    '作用:缴费
    '参数:(str As String, pno As String, bno As String, number As Double)
    Public Sub BuiDelete(pno As String)
        Try
            Dim strsql As String = "delete from Building where Bno ='" & pno & "'"
            Dim objconn As New SqlConnection(conn2)
            Dim objcmd As New SqlCommand(strsql, objconn)

            objconn.Open()
            objcmd.ExecuteNonQuery()

            ' MsgBox("修改成功!")

            objconn.Close()
        Catch ex As Exception
            MsgBox("BuiDelete:" + ex.Message)
        End Try
    End Sub
End Module

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

CaoPengCheng&

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值