' /////////////////////////////////////////////////////////////////////////// ' // Description: Data Access class for the table 'BAA_SHU_Extrakt_Merkmale' ' // Generated by LLBLGen v1.21.2003.712 Final on: Sonntag, 3. Februar 2013, 16:27:18 ' // Because the Base Class already implements IDispose, this class doesn't. ' /////////////////////////////////////////////////////////////////////////// Imports System Imports System.Data Imports System.Data.SqlTypes Imports System.Data.SqlClient Namespace DB ''' ''' Purpose: Data Access class for the table 'BAA_SHU_Extrakt_Merkmale'. ''' Public Class clsBAA_SHU_Extrakt_Merkmale Inherits clsDBInteractionBase #Region " Class Member Declarations " Private m_iFormatNr, m_iID, m_iMerkmalNr, m_iObjektNr As SqlInt32 Private m_sBezeichnung, m_sWert As SqlString #End Region ''' ''' Purpose: Class constructor. ''' Public Sub New() ' // Nothing for now. End Sub ''' ''' Purpose: Insert method. This method will insert one new row into the database. ''' ''' True if succeeded, otherwise an Exception is thrown. ''' ''' Properties needed for this method: ''' ''' Properties set after a succesful call of this method: ''' ''' Overrides Public Function Insert() As Boolean Dim scmCmdToExecute As SqlCommand = New SqlCommand() scmCmdToExecute.CommandText = "dbo.[pr_BAA_SHU_Extrakt_Merkmale_Insert]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@iObjektNr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iObjektNr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sBezeichnung", SqlDbType.NVarChar, 50, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sBezeichnung)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iMerkmalNr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iMerkmalNr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iFormatNr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iFormatNr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sWert", SqlDbType.NVarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sWert)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iID", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iID)) 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. m_iRowsAffected = scmCmdToExecute.ExecuteNonQuery() m_iErrorCode = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iErrorCode").Value, SqlInt32)) If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then ' // Throw error. Throw New Exception("Stored Procedure 'pr_BAA_SHU_Extrakt_Merkmale_Insert' reported the ErrorCode: " & m_iErrorCode.ToString()) End If Return True Catch ex As Exception ' // some error occured. Bubble it to caller and encapsulate Exception object Throw New Exception("clsBAA_SHU_Extrakt_Merkmale::Insert::Error occured.", ex) Finally If m_bMainConnectionIsCreatedLocal Then ' // Close connection. m_scoMainConnection.Close() End If scmCmdToExecute.Dispose() End Try End Function ''' ''' Purpose: SelectAll method. This method will Select all rows from the table. ''' ''' DataTable object if succeeded, otherwise an Exception is thrown. ''' ''' Properties set after a succesful call of this method: ''' ''' Overrides Public Function SelectAll() As DataTable Dim scmCmdToExecute As SqlCommand = New SqlCommand() scmCmdToExecute.CommandText = "dbo.[pr_BAA_SHU_Extrakt_Merkmale_SelectAll]" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = new DataTable("BAA_SHU_Extrakt_Merkmale") Dim sdaAdapter As SqlDataAdapter = new SqlDataAdapter(scmCmdToExecute) ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try 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 = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iErrorCode").Value, SqlInt32)) If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then ' // Throw error. Throw New Exception("Stored Procedure 'pr_BAA_SHU_Extrakt_Merkmale_SelectAll' reported the ErrorCode: " & m_iErrorCode.ToString()) End If Return dtToReturn Catch ex As Exception ' // some error occured. Bubble it to caller and encapsulate Exception object Throw New Exception("clsBAA_SHU_Extrakt_Merkmale::SelectAll::Error occured.", ex) Finally If m_bMainConnectionIsCreatedLocal Then ' // Close connection. m_scoMainConnection.Close() End If scmCmdToExecute.Dispose() sdaAdapter.Dispose() End Try End Function #Region " Class Property Declarations " Public Property [iObjektNr]() As SqlInt32 Get Return m_iObjektNr End Get Set(ByVal Value As SqlInt32) m_iObjektNr = Value End Set End Property Public Property [sBezeichnung]() As SqlString Get Return m_sBezeichnung End Get Set(ByVal Value As SqlString) m_sBezeichnung = Value End Set End Property Public Property [iMerkmalNr]() As SqlInt32 Get Return m_iMerkmalNr End Get Set(ByVal Value As SqlInt32) m_iMerkmalNr = Value End Set End Property Public Property [iFormatNr]() As SqlInt32 Get Return m_iFormatNr End Get Set(ByVal Value As SqlInt32) m_iFormatNr = Value End Set End Property Public Property [sWert]() As SqlString Get Return m_sWert End Get Set(ByVal Value As SqlString) m_sWert = Value End Set End Property Public Property [iID]() As SqlInt32 Get Return m_iID End Get Set(ByVal Value As SqlInt32) m_iID = Value End Set End Property #End Region End Class End Namespace