Verbesserung der Stabilität und Fehlerbehandlung
- `MSSQLServer.vb`: Konvertierung von `Nothing`-Werten zu `DBNull.Value` und detaillierte Protokollierung von SQL-Fehlern hinzugefügt. - `AssemblyInfo.vb`: Aktualisierung der Assembly-Version auf `2.4.0.0`. - `Client.vb`: Einführung von `_IsReconnecting`, um parallele Reconnects zu verhindern. Verbesserte Fehlerbehandlung, Protokollierung und Ressourcenfreigabe. - `MailSession.vb`: Konsistentere Protokollierung, Änderung von `Info` zu `Debug` beim Schließen der Verbindung. - `EDMI.API.vbproj`: Hinzufügen der Datei `ErrorLog.txt`. - `ErrorLog.txt`: Dokumentation von Timeout- und Verbindungsproblemen mit detaillierten Stack-Traces. Diese Änderungen verbessern die Stabilität, Fehlertoleranz und Protokollierungsqualität der Anwendung.
This commit is contained in:
@@ -494,14 +494,30 @@ Public Class MSSQLServer
|
||||
pSqlCommandObject.Connection = pSqlConnection
|
||||
pSqlCommandObject.Transaction = oTransaction
|
||||
pSqlCommandObject.CommandTimeout = pTimeout
|
||||
|
||||
' Sicherstellen, dass Nothing-Werte als DBNull übergeben werden
|
||||
For Each oParam As SqlParameter In pSqlCommandObject.Parameters
|
||||
If oParam.Value Is Nothing Then
|
||||
Logger.Warn("ExecuteNonQueryWithConnectionObject: Parameter [{0}] was Nothing - converting to DBNull.Value", oParam.ParameterName)
|
||||
oParam.Value = DBNull.Value
|
||||
End If
|
||||
Next
|
||||
|
||||
pSqlCommandObject.ExecuteNonQuery()
|
||||
|
||||
Return True
|
||||
Catch ex As SqlException
|
||||
Logger.Warn("ExecuteNonQueryWithConnectionObject: SQL Error while executing command: [{0}]", pSqlCommandObject.CommandText)
|
||||
Logger.Warn("Parameters: [{0}]", GetParameterListAsString(pSqlCommandObject))
|
||||
For Each sqlError As SqlError In ex.Errors
|
||||
Logger.Error("SQL Error #{0} (Severity {1}, State {2}, Line {3}): {4}",
|
||||
sqlError.Number, sqlError.Class, sqlError.State, sqlError.LineNumber, sqlError.Message)
|
||||
Next
|
||||
Return False
|
||||
Catch ex As Exception
|
||||
Dim omsg = $"Unexpected Error in ExecuteNonQueryWithConnectionObject while executing command: [{pSqlCommandObject.CommandText}]"
|
||||
Logger.Warn(omsg)
|
||||
Logger.Warn("Unexpected Error in ExecuteNonQueryWithConnectionObject while executing command: [{0}]", pSqlCommandObject.CommandText)
|
||||
Logger.Warn("Parameters: [{0}]", GetParameterListAsString(pSqlCommandObject))
|
||||
Logger.Error(ex)
|
||||
|
||||
Return False
|
||||
Finally
|
||||
MaybeCommitTransaction(oTransaction, pTransactionMode)
|
||||
|
||||
Reference in New Issue
Block a user