' /////////////////////////////////////////////////////////////////////////// ' // Description: Data Access class for the table 'Kuendigungsfrist' ' // Generated by LLBLGen v1.21.2003.712 Final on: Mittwoch, 19. November 2008, 15:18:57 ' // 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 'Kuendigungsfrist'. ''' Public Class clsKuendigungsfrist Inherits clsDBInteractionBase #Region " Class Member Declarations " Private m_bAktiv As SqlBoolean Private m_daErstellt_am, m_daKuendigungstermin, m_daMutiert_am As SqlDateTime Private m_iSecurityLevelNr, m_iMutierer, m_iVertragselementNr, m_iVertragselementNrOld, m_iKuendigungsfristNr As SqlInt32 Private m_sBemerkung, m_sKuendigungsfirst, m_sVarZeitspanne 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_Kuendigungsfrist_Insert]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@iKuendigungsfristNr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iKuendigungsfristNr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iVertragselementNr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iVertragselementNr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sVarZeitspanne", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sVarZeitspanne)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sKuendigungsfirst", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sKuendigungsfirst)) scmCmdToExecute.Parameters.Add(New SqlParameter("@daKuendigungstermin", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daKuendigungstermin)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sBemerkung", SqlDbType.VarChar, 50, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sBemerkung)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iSecurityLevelNr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iSecurityLevelNr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@daErstellt_am", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daErstellt_am)) scmCmdToExecute.Parameters.Add(New SqlParameter("@daMutiert_am", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daMutiert_am)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iMutierer", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iMutierer)) scmCmdToExecute.Parameters.Add(New SqlParameter("@bAktiv", SqlDbType.Bit, 1, ParameterDirection.Input, True, 1, 0, "", DataRowVersion.Proposed, m_bAktiv)) 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_Kuendigungsfrist_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("clsKuendigungsfrist::Insert::Error occured.", ex) Finally If m_bMainConnectionIsCreatedLocal Then ' // Close connection. m_scoMainConnection.Close() End If scmCmdToExecute.Dispose() End Try End Function ''' ''' Purpose: Update method. This method will Update one existing row in 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 Update() As Boolean Dim scmCmdToExecute As SqlCommand = New SqlCommand() scmCmdToExecute.CommandText = "dbo.[pr_Kuendigungsfrist_Update]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@iKuendigungsfristNr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iKuendigungsfristNr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iVertragselementNr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iVertragselementNr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sVarZeitspanne", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sVarZeitspanne)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sKuendigungsfirst", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sKuendigungsfirst)) scmCmdToExecute.Parameters.Add(New SqlParameter("@daKuendigungstermin", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daKuendigungstermin)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sBemerkung", SqlDbType.VarChar, 50, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sBemerkung)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iSecurityLevelNr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iSecurityLevelNr)) scmCmdToExecute.Parameters.Add(New SqlParameter("@daErstellt_am", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daErstellt_am)) scmCmdToExecute.Parameters.Add(New SqlParameter("@daMutiert_am", SqlDbType.DateTime, 8, ParameterDirection.Input, True, 23, 3, "", DataRowVersion.Proposed, m_daMutiert_am)) scmCmdToExecute.Parameters.Add(New SqlParameter("@iMutierer", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iMutierer)) scmCmdToExecute.Parameters.Add(New SqlParameter("@bAktiv", SqlDbType.Bit, 1, ParameterDirection.Input, True, 1, 0, "", DataRowVersion.Proposed, m_bAktiv)) 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_Kuendigungsfrist_Update' 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("clsKuendigungsfrist::Update::Error occured.", ex) Finally If m_bMainConnectionIsCreatedLocal Then ' // Close connection. m_scoMainConnection.Close() End If scmCmdToExecute.Dispose() End Try End Function ''' ''' Purpose: Update method for updating one or more rows using the Foreign Key 'VertragselementNr. ''' This method will Update one or more existing rows in the database. It will reset the field 'VertragselementNr' in ''' all rows which have as value for this field the value as set in property 'iVertragselementNrOld' to ''' the value as set in property 'iVertragselementNr'. ''' ''' True if succeeded, otherwise an Exception is thrown. ''' ''' Properties needed for this method: ''' ''' Properties set after a succesful call of this method: ''' ''' Public Function UpdateAllWVertragselementNrLogic() As Boolean Dim scmCmdToExecute As SqlCommand = New SqlCommand() scmCmdToExecute.CommandText = "dbo.[pr_Kuendigungsfrist_UpdateAllWVertragselementNrLogic]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(new SqlParameter("@iVertragselementNr", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, m_iVertragselementNr)) scmCmdToExecute.Parameters.Add(new SqlParameter("@iVertragselementNrOld", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iVertragselementNrOld)) 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_iVertragselementNr = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iVertragselementNr").Value, Integer)) If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then ' // Throw error. Throw New Exception("Stored Procedure 'pr_Kuendigungsfrist_UpdateAllWVertragselementNrLogic' 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("clsKuendigungsfrist::UpdateAllWVertragselementNrLogic::Error occured.", ex) Finally If m_bMainConnectionIsCreatedLocal Then ' // Close connection. m_scoMainConnection.Close() End If scmCmdToExecute.Dispose() End Try End Function ''' ''' Purpose: Delete method. This method will Delete one existing row in the database, based on the Primary Key. ''' ''' 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 Delete() As Boolean Dim scmCmdToExecute As SqlCommand = New SqlCommand() scmCmdToExecute.CommandText = "dbo.[pr_Kuendigungsfrist_Delete]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@iKuendigungsfristNr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iKuendigungsfristNr)) 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_Kuendigungsfrist_Delete' 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("clsKuendigungsfrist::Delete::Error occured.", ex) Finally If m_bMainConnectionIsCreatedLocal Then ' // Close connection. m_scoMainConnection.Close() End If scmCmdToExecute.Dispose() End Try End Function ''' ''' Purpose: Delete method for a foreign key. This method will Delete one or more rows from the database, based on the Foreign Key 'VertragselementNr' ''' ''' true if succeeded, false otherwise ''' ''' Properties needed for this method: ''' ''' Properties set after a succesful call of this method: ''' ''' Public Function DeleteAllWVertragselementNrLogic() As Boolean Dim scmCmdToExecute As SqlCommand = New SqlCommand() scmCmdToExecute.CommandText = "dbo.[pr_Kuendigungsfrist_DeleteAllWVertragselementNrLogic]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(new SqlParameter("@iVertragselementNr", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, m_iVertragselementNr)) 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_iVertragselementNr = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iVertragselementNr").Value, Integer)) If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then ' // Throw error. Throw New Exception("Stored Procedure 'pr_Kuendigungsfrist_DeleteAllWVertragselementNrLogic' 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("clsKuendigungsfrist::DeleteAllWVertragselementNrLogic::Error occured.", ex) Finally If m_bMainConnectionIsCreatedLocal Then ' // Close connection. m_scoMainConnection.Close() End If scmCmdToExecute.Dispose() End Try End Function ''' ''' Purpose: Select method. This method will Select one existing row from the database, based on the Primary Key. ''' ''' DataTable object if succeeded, otherwise an Exception is thrown. ''' ''' Properties needed for this method: ''' ''' Properties set after a succesful call of this method: ''' ''' Will fill all properties corresponding with a field in the table with the value of the row selected. ''' Overrides Public Function SelectOne() As DataTable Dim scmCmdToExecute As SqlCommand = New SqlCommand() scmCmdToExecute.CommandText = "dbo.[pr_Kuendigungsfrist_SelectOne]" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = new DataTable("Kuendigungsfrist") Dim sdaAdapter As SqlDataAdapter = new SqlDataAdapter(scmCmdToExecute) ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(new SqlParameter("@iKuendigungsfristNr", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iKuendigungsfristNr)) 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_Kuendigungsfrist_SelectOne' reported the ErrorCode: " & m_iErrorCode.ToString()) End If If dtToReturn.Rows.Count > 0 Then m_iKuendigungsfristNr = New SqlInt32(CType(dtToReturn.Rows(0)("KuendigungsfristNr"), Integer)) If dtToReturn.Rows(0)("VertragselementNr") Is System.DBNull.Value Then m_iVertragselementNr = SqlInt32.Null Else m_iVertragselementNr = New SqlInt32(CType(dtToReturn.Rows(0)("VertragselementNr"), Integer)) End If If dtToReturn.Rows(0)("VarZeitspanne") Is System.DBNull.Value Then m_sVarZeitspanne = SqlString.Null Else m_sVarZeitspanne = New SqlString(CType(dtToReturn.Rows(0)("VarZeitspanne"), String)) End If If dtToReturn.Rows(0)("Kuendigungsfirst") Is System.DBNull.Value Then m_sKuendigungsfirst = SqlString.Null Else m_sKuendigungsfirst = New SqlString(CType(dtToReturn.Rows(0)("Kuendigungsfirst"), String)) End If If dtToReturn.Rows(0)("Kuendigungstermin") Is System.DBNull.Value Then m_daKuendigungstermin = SqlDateTime.Null Else m_daKuendigungstermin = New SqlDateTime(CType(dtToReturn.Rows(0)("Kuendigungstermin"), Date)) End If If dtToReturn.Rows(0)("Bemerkung") Is System.DBNull.Value Then m_sBemerkung = SqlString.Null Else m_sBemerkung = New SqlString(CType(dtToReturn.Rows(0)("Bemerkung"), String)) End If If dtToReturn.Rows(0)("SecurityLevelNr") Is System.DBNull.Value Then m_iSecurityLevelNr = SqlInt32.Null Else m_iSecurityLevelNr = New SqlInt32(CType(dtToReturn.Rows(0)("SecurityLevelNr"), Integer)) End If If dtToReturn.Rows(0)("Erstellt_am") Is System.DBNull.Value Then m_daErstellt_am = SqlDateTime.Null Else m_daErstellt_am = New SqlDateTime(CType(dtToReturn.Rows(0)("Erstellt_am"), Date)) End If If dtToReturn.Rows(0)("Mutiert_am") Is System.DBNull.Value Then m_daMutiert_am = SqlDateTime.Null Else m_daMutiert_am = New SqlDateTime(CType(dtToReturn.Rows(0)("Mutiert_am"), Date)) End If If dtToReturn.Rows(0)("Mutierer") Is System.DBNull.Value Then m_iMutierer = SqlInt32.Null Else m_iMutierer = New SqlInt32(CType(dtToReturn.Rows(0)("Mutierer"), Integer)) End If If dtToReturn.Rows(0)("Aktiv") Is System.DBNull.Value Then m_bAktiv = SqlBoolean.Null Else m_bAktiv = New SqlBoolean(CType(dtToReturn.Rows(0)("Aktiv"), Boolean)) End If End If Return dtToReturn Catch ex As Exception ' // some error occured. Bubble it to caller and encapsulate Exception object Throw New Exception("clsKuendigungsfrist::SelectOne::Error occured.", ex) Finally If m_bMainConnectionIsCreatedLocal Then ' // Close connection. m_scoMainConnection.Close() End If scmCmdToExecute.Dispose() sdaAdapter.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_Kuendigungsfrist_SelectAll]" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = new DataTable("Kuendigungsfrist") 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_Kuendigungsfrist_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("clsKuendigungsfrist::SelectAll::Error occured.", ex) Finally If m_bMainConnectionIsCreatedLocal Then ' // Close connection. m_scoMainConnection.Close() End If scmCmdToExecute.Dispose() sdaAdapter.Dispose() End Try End Function ''' ''' Purpose: Select method for a foreign key. This method will Select one or more rows from the database, based on the Foreign Key 'VertragselementNr' ''' ''' DataTable object if succeeded, otherwise an Exception is thrown. ''' ''' Properties needed for this method: ''' ''' Properties set after a succesful call of this method: ''' ''' Public Function SelectAllWVertragselementNrLogic() As DataTable Dim scmCmdToExecute As SqlCommand = New SqlCommand() scmCmdToExecute.CommandText = "dbo.[pr_Kuendigungsfrist_SelectAllWVertragselementNrLogic]" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = new DataTable("Kuendigungsfrist") Dim sdaAdapter As SqlDataAdapter = new SqlDataAdapter(scmCmdToExecute) ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(new SqlParameter("@iVertragselementNr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iVertragselementNr)) 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_iVertragselementNr = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iVertragselementNr").Value, Integer)) If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then ' // Throw error. Throw New Exception("Stored Procedure 'pr_Kuendigungsfrist_SelectAllWVertragselementNrLogic' 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("clsKuendigungsfrist::SelectAllWVertragselementNrLogic::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 [iKuendigungsfristNr]() As SqlInt32 Get Return m_iKuendigungsfristNr End Get Set(ByVal Value As SqlInt32) Dim iKuendigungsfristNrTmp As SqlInt32 = Value If iKuendigungsfristNrTmp.IsNull Then Throw New ArgumentOutOfRangeException("iKuendigungsfristNr", "iKuendigungsfristNr can't be NULL") End If m_iKuendigungsfristNr = Value End Set End Property Public Property [iVertragselementNr]() As SqlInt32 Get Return m_iVertragselementNr End Get Set(ByVal Value As SqlInt32) m_iVertragselementNr = Value End Set End Property Public Property [iVertragselementNrOld]() As SqlInt32 Get Return m_iVertragselementNrOld End Get Set(ByVal Value As SqlInt32) m_iVertragselementNrOld = Value End Set End Property Public Property [sVarZeitspanne]() As SqlString Get Return m_sVarZeitspanne End Get Set(ByVal Value As SqlString) m_sVarZeitspanne = Value End Set End Property Public Property [sKuendigungsfirst]() As SqlString Get Return m_sKuendigungsfirst End Get Set(ByVal Value As SqlString) m_sKuendigungsfirst = Value End Set End Property Public Property [daKuendigungstermin]() As SqlDateTime Get Return m_daKuendigungstermin End Get Set(ByVal Value As SqlDateTime) m_daKuendigungstermin = Value End Set End Property Public Property [sBemerkung]() As SqlString Get Return m_sBemerkung End Get Set(ByVal Value As SqlString) m_sBemerkung = Value End Set End Property Public Property [iSecurityLevelNr]() As SqlInt32 Get Return m_iSecurityLevelNr End Get Set(ByVal Value As SqlInt32) m_iSecurityLevelNr = Value End Set End Property Public Property [daErstellt_am]() As SqlDateTime Get Return m_daErstellt_am End Get Set(ByVal Value As SqlDateTime) m_daErstellt_am = Value End Set End Property Public Property [daMutiert_am]() As SqlDateTime Get Return m_daMutiert_am End Get Set(ByVal Value As SqlDateTime) m_daMutiert_am = Value End Set End Property Public Property [iMutierer]() As SqlInt32 Get Return m_iMutierer End Get Set(ByVal Value As SqlInt32) m_iMutierer = Value End Set End Property Public Property [bAktiv]() As SqlBoolean Get Return m_bAktiv End Get Set(ByVal Value As SqlBoolean) m_bAktiv = Value End Set End Property #End Region End Class End Namespace