Purpose: Update method for updating one or more rows using the Foreign Key 'VertragspartnerNr. This method will Update one or more existing rows in the database. It will reset the field 'VertragspartnerNr' in all rows which have as value for this field the value as set in property 'iVertragspartnerNrOld' to the value as set in property 'iVertragspartnerNr'.
[Visual Basic] Public Function UpdateAllWVertragspartnerNrLogic() As Boolean
True if succeeded, otherwise an Exception is thrown.
Properties needed for this method: <UL> <LI>iVertragspartnerNr. May be SqlInt32.Null</LI> <LI>iVertragspartnerNrOld. May be SqlInt32.Null</LI> </UL> Properties set after a succesful call of this method: <UL> <LI>iErrorCode</LI> </UL>
[Visual Basic] Public Function UpdateAllWVertragspartnerNrLogic() As Boolean
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.[pr_Vertragselement_UpdateAllWVertragspartnerNrLogic]"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
' // Use base class' connection object
scmCmdToExecute.Connection = m_scoMainConnection
Try
scmCmdToExecute.Parameters.Add(new SqlParameter("@iVertragspartnerNr", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, m_iVertragspartnerNr))
scmCmdToExecute.Parameters.Add(new SqlParameter("@iVertragspartnerNrOld", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, m_iVertragspartnerNrOld))
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_iVertragspartnerNr = New SqlInt32(CType(scmCmdToExecute.Parameters.Item("@iVertragspartnerNr").Value, Integer))
If Not m_iErrorCode.Equals(New SqlInt32(LLBLError.AllOk)) Then
' // Throw error.
Throw New Exception("Stored Procedure 'pr_Vertragselement_UpdateAllWVertragspartnerNrLogic' 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("clsVertragselement::UpdateAllWVertragspartnerNrLogic::Error occured.", ex)
Finally
If m_bMainConnectionIsCreatedLocal Then
' // Close connection.
m_scoMainConnection.Close()
End If
scmCmdToExecute.Dispose()
End Try
End Function
Plattformen: Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition