VB.NET 3层应用程序。没有数据输出

时间:2014-05-04 21:31:55

标签: vb.net

我正在开发一个VB.Net 3层应用程序。出于某种原因,我的GetDataInfo()没有从DataAccessLayer获取任何数据。你们能看出它有什么问题吗? 我已经创建了我的数据集和连接字符串,一切都已连接。我只是不知道它有什么问题。

Imports JagBankAccounts.DataAccessLayer
Imports JagBankAccounts.DataAccessLayer.JagBankAccountsDataSetTableAdapters

Public Class Accounts

    Implements IComparable

    Private myAdapter As New DataAccessLayer.JagBankAccountsDataSetTableAdapters.AccountsTableAdapter

    Dim catchError As String
    Private mAccountID As Short
    Private mAccountTypeID As Short
    Private mCustomerName As String
    Private mOpeningDate As Date
    Private mClosingDate As Date
    Private mBalance As Double

    Public Property AccountID() As Short
        Get
            Return mAccountID
        End Get
        Set(value As Short)
            mAccountID = value
        End Set
    End Property

    Public Property AccountTypeID() As Short
        Get
            Return mAccountTypeID
        End Get
        Set(value As Short)
            mAccountTypeID = value
        End Set
    End Property

    Public Property CustomerName As String
        Get
            Return mCustomerName
        End Get
        Set(value As String)
            mCustomerName = value
        End Set
    End Property

    Public Property OpeningDate As Date
        Get
            Return mOpeningDate
        End Get
        Set(value As Date)
            mOpeningDate = value
        End Set
    End Property

    Public Property ClosingDate As Date
        Get
            Return mClosingDate
        End Get
        Set(value As Date)
            mClosingDate = value
        End Set
    End Property

    Public Property Balance As Double
        Get
            Return mBalance
        End Get
        Set(value As Double)
            mBalance = value
        End Set
    End Property

    Public Sub New()
        mAccountID = 0
        mAccountTypeID = 0
        mCustomerName = ""
        mOpeningDate = Date.Today
        mClosingDate = Date.Today
        mBalance = 0.0
    End Sub

    Public Sub New(ByVal pAccountId As Short, ByVal pAccountTypeId As Short, ByVal pCustomerName As String,
                   ByVal pOpeningDate As Date, ByVal pClosingDate As Date, ByVal pBalance As Double)
        mAccountID = pAccountId
        mAccountTypeID = pAccountTypeId
        mCustomerName = pCustomerName
        mOpeningDate = pOpeningDate
        mClosingDate = pClosingDate
        mBalance = pBalance
    End Sub

    Public ReadOnly Property GetDataInfo() As DataTable
        Get
            Dim table As DataTable = myAdapter.GetData()
            Return table
        End Get
    End Property

    Public Function Add(ByVal pAccountTypeId As Short, ByVal pCustomerName As String,
                   ByVal pOpeningDate As Date, ByVal pClosingDate As Date, ByVal pBalance As Double)
        Try
            catchError = String.Empty
            myAdapter.Insert(AccountTypeID, CustomerName, OpeningDate, ClosingDate, Balance)
            Return True
        Catch ex As Exception
            catchError = ex.Message
            Return False
        End Try
    End Function

    Public Function CompareTo(obj As Object) As Integer Implements System.IComparable.CompareTo
        Return mAccountID.CompareTo(CType(obj, Accounts).mAccountID)
    End Function
End Class

0 个答案:

没有答案