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

Syntax

Visual Basic

Public Function get_dbkey( _
   ByVal Tablename As String _
) As Long

C#

public long get_dbkey(
   stringTablename
)

C++

public: 
long get_dbkey(
   StringTablename

JScript

public function get_dbkey(
    Tablename : String
) : long;

Parameters

Tablename

 

 

 

 

Source code

Visual Basic

 Public Function get_dbkey(ByVal Tablename As String) As Long
    Dim m_dbkey As Long
    Dim scmCmdToExecute As SqlCommand = New SqlCommand()
    scmCmdToExecute.CommandText = "dbo.[sp_get_dbkey]"
    scmCmdToExecute.CommandType = CommandType.StoredProcedure
    ' // Use base class' connection object
    scmCmdToExecute.Connection = m_scoMainConnection
    Try
        scmCmdToExecute.Parameters.Add(New SqlParameter("@Tablename", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, Tablename))
        scmCmdToExecute.Parameters.Add(New SqlParameter("@dbkey", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, m_dbkey))
        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.
        Try
            scmCmdToExecute.Connection.Open()
        Catch ex As Exception
        Finally
        End Try
 
        scmCmdToExecute.ExecuteNonQuery()
        m_dbkey = scmCmdToExecute.Parameters.Item("@dbkey").Value
        m_iErrorCode = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iErrorCode").Value, SqlInt32))
        scmCmdToExecute.Connection.Close()
 
        If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
            ' // Throw error.
            Throw New Exception("Stored Procedure 'sp_get_dbkey' reported the ErrorCode: " & m_iErrorCode.ToString())
        End If
 
        Return m_dbkey
    Catch ex As Exception
            ' // some error occured. Bubble it to caller and encapsulate Exception object
            Throw New Exception("clsKey_tabelle::get_dbkey::Error occured." + ex.Message, ex)
        Finally
            If m_bMainConnectionIsCreatedLocal Then
                ' // Close connection.
                m_scoMainConnection.Close()
            End If
            scmCmdToExecute.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