Namespace: EDKB12WS.edokadb
Assembly: EDKB12WS (in EDKB12WS.exe)

Syntax

Visual Basic

Public Overrides Function SelectOne() As DataTable

C#

public override DataTable SelectOne()

C++

public: 
DataTable^ SelectOne() 

JScript

public function SelectOne() : DataTable;

 

Source code

Visual Basic

    Overrides Public Function SelectOne() As DataTable
      Dim scmCmdToExecute As SqlCommand = New SqlCommand()
      scmCmdToExecute.CommandText = "dbo.[pr_Journaleintrag_SelectOne]"
      scmCmdToExecute.CommandType = CommandType.StoredProcedure
      Dim dtToReturn As DataTable = new DataTable("Journaleintrag")
      Dim sdaAdapter As SqlDataAdapter = new SqlDataAdapter(scmCmdToExecute)
 
      ' // Use base class' connection object
      scmCmdToExecute.Connection = m_scoMainConnection
 
      Try
        scmCmdToExecute.Parameters.Add(new SqlParameter("@ijournaleintragnr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iJournaleintragnr))
        scmCmdToExecute.Parameters.Add(new SqlParameter("@iErrorCode", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_iErrorCode))
 
        If m_bMainConnectionIsCreatedLocal Then
          ' // Open connection.
          m_scoMainConnection.Open()
        Else
          If m_cpMainConnectionProvider.bIsTransactionPending Then
            scmCmdToExecute.Transaction = m_cpMainConnectionProvider.stCurrentTransaction
          End If
        End If
 
        ' // Execute query.
        sdaAdapter.Fill(dtToReturn)
                m_iErrorCode = scmCmdToExecute.Parameters.Item("@iErrorCode").Value
 
        If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
          ' // Throw error.
          Throw New Exception("Stored Procedure 'pr_Journaleintrag_SelectOne' reported the ErrorCode: " & m_iErrorCode.ToString())
        End If
 
        If dtToReturn.Rows.Count > 0 Then
          m_iJournaleintragnr = New SqlInt32(CType(dtToReturn.Rows(0)("journaleintragnr"), Integer))
          If dtToReturn.Rows(0)("journalnr") Is System.DBNull.Value Then
            m_iJournalnr = SqlInt32.Null
          Else
            m_iJournalnr = New SqlInt32(CType(dtToReturn.Rows(0)("journalnr"), Integer))
          End If
          If dtToReturn.Rows(0)("eintrag") Is System.DBNull.Value Then
            m_sEintrag = SqlString.Null
          Else
            m_sEintrag = New SqlString(CType(dtToReturn.Rows(0)("eintrag"), String))
          End If
          If dtToReturn.Rows(0)("datumzeit") Is System.DBNull.Value Then
            m_daDatumzeit = SqlDateTime.Null
          Else
            m_daDatumzeit = New SqlDateTime(CType(dtToReturn.Rows(0)("datumzeit"), Date))
          End If
        End If
        Return dtToReturn
      Catch ex As Exception
        ' // some error occured. Bubble it to caller and encapsulate Exception object
        Throw New Exception("clsJournaleintrag::SelectOne::Error occured.", ex)
      Finally
        If m_bMainConnectionIsCreatedLocal Then
          ' // Close connection.
          m_scoMainConnection.Close()
        End If
        scmCmdToExecute.Dispose()
        sdaAdapter.Dispose()
      End Try
    End Function 

Platforms

Windows 8, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

 

Version Information

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0
 

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0
 

XNA Framework

Supported in: 3.0, 2.0, 1.0
 

 

See Also