' /////////////////////////////////////////////////////////////////////////// ' // Description: Data Access class for the table 'zzz_testa' ' // Generated by LLBLGen v1.21.2003.712 Final on: Freitag, 8. Mai 2009, 11:27:36 ' // 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 TKB.VV.DB ''' ''' Purpose: Data Access class for the table 'zzz_testa'. ''' Public Class clsZzz_testa Inherits clsDBInteractionBase #Region " Class Member Declarations " Private m_sNeu, m_sAlt, m_sFeld 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_zzz_testa_Insert]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@sFeld", SqlDbType.VarChar, 50, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sFeld)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sAlt", SqlDbType.VarChar, 50, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sAlt)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sNeu", SqlDbType.VarChar, 50, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sNeu)) 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_zzz_testa_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("clsZzz_testa::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_zzz_testa_SelectAll]" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = new DataTable("zzz_testa") 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_zzz_testa_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("clsZzz_testa::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 [sFeld]() As SqlString Get Return m_sFeld End Get Set(ByVal Value As SqlString) m_sFeld = Value End Set End Property Public Property [sAlt]() As SqlString Get Return m_sAlt End Get Set(ByVal Value As SqlString) m_sAlt = Value End Set End Property Public Property [sNeu]() As SqlString Get Return m_sNeu End Get Set(ByVal Value As SqlString) m_sNeu = Value End Set End Property #End Region End Class End Namespace