' /////////////////////////////////////////////////////////////////////////// ' // Description: Data Access class for the table 'edoka_adressen' ' // Generated by LLBLGen v1.2.1045.38210 Final on: Sonntag, 9. Februar 2003, 12:18:51 ' // 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 edokadb ' /// ' /// Purpose: Data Access class for the table 'edoka_adressen'. ' /// Public Class clsEdoka_adressen Inherits clsDBInteractionBase #Region " Class Member Declarations " Private m_iNrpar00 As SqlInt32 Private m_sAdresszeile5, m_sAdresszeile6, m_sAdresszeile7, m_sAdresszeile4, m_sAdresszeile1, m_sAdresszeile2, m_sAdresszeile3 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_edoka_adressen_Insert]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@inrpar00", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iNrpar00)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sadresszeile1", SqlDbType.VarChar, 50, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sAdresszeile1)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sadresszeile2", SqlDbType.VarChar, 50, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sAdresszeile2)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sadresszeile3", SqlDbType.VarChar, 50, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sAdresszeile3)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sadresszeile4", SqlDbType.VarChar, 50, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sAdresszeile4)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sadresszeile5", SqlDbType.VarChar, 50, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sAdresszeile5)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sadresszeile6", SqlDbType.VarChar, 50, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sAdresszeile6)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sadresszeile7", SqlDbType.VarChar, 50, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sAdresszeile7)) 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. 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_edoka_adressen_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("clsEdoka_adressen::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_edoka_adressen_Update]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@inrpar00", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iNrpar00)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sadresszeile1", SqlDbType.VarChar, 50, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sAdresszeile1)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sadresszeile2", SqlDbType.VarChar, 50, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sAdresszeile2)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sadresszeile3", SqlDbType.VarChar, 50, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sAdresszeile3)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sadresszeile4", SqlDbType.VarChar, 50, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sAdresszeile4)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sadresszeile5", SqlDbType.VarChar, 50, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sAdresszeile5)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sadresszeile6", SqlDbType.VarChar, 50, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sAdresszeile6)) scmCmdToExecute.Parameters.Add(New SqlParameter("@sadresszeile7", SqlDbType.VarChar, 50, ParameterDirection.Input, True, 0, 0, "", DataRowVersion.Proposed, m_sAdresszeile7)) 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. 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_edoka_adressen_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("clsEdoka_adressen::Update::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: ' /// ' /// Public Overrides Function Delete() As Boolean Dim scmCmdToExecute As SqlCommand = New SqlCommand() scmCmdToExecute.CommandText = "dbo.[pr_edoka_adressen_Delete]" scmCmdToExecute.CommandType = CommandType.StoredProcedure ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(New SqlParameter("@inrpar00", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iNrpar00)) 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. 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_edoka_adressen_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("clsEdoka_adressen::Delete::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_edoka_adressen_SelectOne]" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = new DataTable("edoka_adressen") Dim sdaAdapter As SqlDataAdapter = new SqlDataAdapter(scmCmdToExecute) ' // Use base class' connection object scmCmdToExecute.Connection = m_scoMainConnection Try scmCmdToExecute.Parameters.Add(new SqlParameter("@inrpar00", SqlDbType.Int, 4, ParameterDirection.Input, False, 10, 0, "", DataRowVersion.Proposed, m_iNrpar00)) 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_edoka_adressen_SelectOne' reported the ErrorCode: " & m_iErrorCode.ToString()) End If If dtToReturn.Rows.Count > 0 Then m_iNrpar00 = New SqlInt32(CType(dtToReturn.Rows(0)("nrpar00"), Integer)) If dtToReturn.Rows(0)("adresszeile1") Is System.DBNull.Value Then m_sAdresszeile1 = SqlString.Null Else m_sAdresszeile1 = New SqlString(CType(dtToReturn.Rows(0)("adresszeile1"), String)) End If If dtToReturn.Rows(0)("adresszeile2") Is System.DBNull.Value Then m_sAdresszeile2 = SqlString.Null Else m_sAdresszeile2 = New SqlString(CType(dtToReturn.Rows(0)("adresszeile2"), String)) End If If dtToReturn.Rows(0)("adresszeile3") Is System.DBNull.Value Then m_sAdresszeile3 = SqlString.Null Else m_sAdresszeile3 = New SqlString(CType(dtToReturn.Rows(0)("adresszeile3"), String)) End If If dtToReturn.Rows(0)("adresszeile4") Is System.DBNull.Value Then m_sAdresszeile4 = SqlString.Null Else m_sAdresszeile4 = New SqlString(CType(dtToReturn.Rows(0)("adresszeile4"), String)) End If If dtToReturn.Rows(0)("adresszeile5") Is System.DBNull.Value Then m_sAdresszeile5 = SqlString.Null Else m_sAdresszeile5 = New SqlString(CType(dtToReturn.Rows(0)("adresszeile5"), String)) End If If dtToReturn.Rows(0)("adresszeile6") Is System.DBNull.Value Then m_sAdresszeile6 = SqlString.Null Else m_sAdresszeile6 = New SqlString(CType(dtToReturn.Rows(0)("adresszeile6"), String)) End If If dtToReturn.Rows(0)("adresszeile7") Is System.DBNull.Value Then m_sAdresszeile7 = SqlString.Null Else m_sAdresszeile7 = New SqlString(CType(dtToReturn.Rows(0)("adresszeile7"), String)) End If End If Return dtToReturn Catch ex As Exception ' // some error occured. Bubble it to caller and encapsulate Exception object Throw New Exception("clsEdoka_adressen::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: ' /// ' /// Public Overrides Function SelectAll() As DataTable Dim scmCmdToExecute As SqlCommand = New SqlCommand() scmCmdToExecute.CommandText = "dbo.[pr_edoka_adressen_SelectAll]" scmCmdToExecute.CommandType = CommandType.StoredProcedure Dim dtToReturn As DataTable = New DataTable("edoka_adressen") 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_edoka_adressen_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("clsEdoka_adressen::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 [iNrpar00]() As SqlInt32 Get Return m_iNrpar00 End Get Set(ByVal Value As SqlInt32) Dim iNrpar00Tmp As SqlInt32 = Value If iNrpar00Tmp.IsNull Then Throw New ArgumentOutOfRangeException("iNrpar00", "iNrpar00 can't be NULL") End If m_iNrpar00 = Value End Set End Property Public Property [sAdresszeile1]() As SqlString Get Return m_sAdresszeile1 End Get Set(ByVal Value As SqlString) m_sAdresszeile1 = Value End Set End Property Public Property [sAdresszeile2]() As SqlString Get Return m_sAdresszeile2 End Get Set(ByVal Value As SqlString) m_sAdresszeile2 = Value End Set End Property Public Property [sAdresszeile3]() As SqlString Get Return m_sAdresszeile3 End Get Set(ByVal Value As SqlString) m_sAdresszeile3 = Value End Set End Property Public Property [sAdresszeile4]() As SqlString Get Return m_sAdresszeile4 End Get Set(ByVal Value As SqlString) m_sAdresszeile4 = Value End Set End Property Public Property [sAdresszeile5]() As SqlString Get Return m_sAdresszeile5 End Get Set(ByVal Value As SqlString) m_sAdresszeile5 = Value End Set End Property Public Property [sAdresszeile6]() As SqlString Get Return m_sAdresszeile6 End Get Set(ByVal Value As SqlString) m_sAdresszeile6 = Value End Set End Property Public Property [sAdresszeile7]() As SqlString Get Return m_sAdresszeile7 End Get Set(ByVal Value As SqlString) m_sAdresszeile7 = Value End Set End Property #End Region End Class End Namespace