fix
This commit is contained in:
@@ -916,28 +916,58 @@ Public Class SQL
|
|||||||
Case "WEB" : conn = GetNewOpenConnectionWEB()
|
Case "WEB" : conn = GetNewOpenConnectionWEB()
|
||||||
Case "PARKZEIT" : conn = GetNewOpenConnectionPARKZEIT()
|
Case "PARKZEIT" : conn = GetNewOpenConnectionPARKZEIT()
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
|
'NOT Working--------------------------------------------
|
||||||
|
|
||||||
|
'Try
|
||||||
|
|
||||||
|
|
||||||
|
' ' MsgBox(sql)
|
||||||
|
' Using cmd As New SqlCommand(sql, conn)
|
||||||
|
' If list IsNot Nothing Then
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
' For Each i In list
|
||||||
|
' If String.IsNullOrWhiteSpace(i.Scalarvariable) Then
|
||||||
|
' Throw New Exception("❌ Leerer Parametername in SQLVariable!")
|
||||||
|
' End If
|
||||||
|
' If i.Scalarvariable.ToLower = "errno" Then
|
||||||
|
' Throw New Exception("❌ Ungültiger Parametername 'errno' – bitte umbenennen.")
|
||||||
|
' End If
|
||||||
|
' If Not System.Text.RegularExpressions.Regex.IsMatch(i.Scalarvariable, "^[a-zA-Z0-9_]+$") Then
|
||||||
|
' Throw New Exception("❌ Ungültiger SQL-Parametername (Regex): '" & i.Scalarvariable & "'")
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' 'MsgBox(i.Text.trim & " " & IIf(i.Value Is Nothing, DBNull.Value, i.Value))
|
||||||
|
' cmd.Parameters.AddWithValue("@" & i.Scalarvariable.trim, IIf(i.Value Is Nothing, DBNull.Value, i.Value))
|
||||||
|
' Next
|
||||||
|
' End If
|
||||||
|
' cmd.ExecuteNonQuery()
|
||||||
|
' End Using
|
||||||
|
' conn.Close()
|
||||||
|
' Return True
|
||||||
|
'Catch ex As Exception
|
||||||
|
' ' MsgBox("ERR!")
|
||||||
|
' If ex.Message.Contains("Falsche Syntax in der Nähe von '@errno'") Then
|
||||||
|
' ' Spezielle Behandlung für den Fehler mit dem Parameter 'errno'
|
||||||
|
' 'VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR("❌ Ungültiger SQL-Parametername 'errno' – bitte umbenennen.", ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name, , , , , sql)
|
||||||
|
|
||||||
|
' ElseIf ex.Message.Contains("Leerer Parametername") Then
|
||||||
|
' If showErr Then VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name, , , , , sql)
|
||||||
|
' End If
|
||||||
|
'End Try
|
||||||
|
'Return False
|
||||||
|
|
||||||
|
'NOT Working--------------------------------------------
|
||||||
|
|
||||||
Try
|
Try
|
||||||
|
|
||||||
|
|
||||||
' MsgBox(sql)
|
' MsgBox(sql)
|
||||||
Using cmd As New SqlCommand(sql, conn)
|
Using cmd As New SqlCommand(sql, conn)
|
||||||
If list IsNot Nothing Then
|
If list IsNot Nothing Then
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
For Each i In list
|
For Each i In list
|
||||||
If String.IsNullOrWhiteSpace(i.Scalarvariable) Then
|
|
||||||
Throw New Exception("❌ Leerer Parametername in SQLVariable!")
|
|
||||||
End If
|
|
||||||
If i.Scalarvariable.ToLower = "errno" Then
|
|
||||||
Throw New Exception("❌ Ungültiger Parametername 'errno' – bitte umbenennen.")
|
|
||||||
End If
|
|
||||||
If Not System.Text.RegularExpressions.Regex.IsMatch(i.Scalarvariable, "^[a-zA-Z0-9_]+$") Then
|
|
||||||
Throw New Exception("❌ Ungültiger SQL-Parametername (Regex): '" & i.Scalarvariable & "'")
|
|
||||||
End If
|
|
||||||
|
|
||||||
'MsgBox(i.Text.trim & " " & IIf(i.Value Is Nothing, DBNull.Value, i.Value))
|
'MsgBox(i.Text.trim & " " & IIf(i.Value Is Nothing, DBNull.Value, i.Value))
|
||||||
cmd.Parameters.AddWithValue("@" & i.Scalarvariable.trim, IIf(i.Value Is Nothing, DBNull.Value, i.Value))
|
cmd.Parameters.AddWithValue("@" & i.Scalarvariable.trim, IIf(i.Value Is Nothing, DBNull.Value, i.Value))
|
||||||
Next
|
Next
|
||||||
@@ -948,15 +978,10 @@ Public Class SQL
|
|||||||
Return True
|
Return True
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
' MsgBox("ERR!")
|
' MsgBox("ERR!")
|
||||||
If ex.Message.Contains("Falsche Syntax in der Nähe von '@errno'") Then
|
|
||||||
' Spezielle Behandlung für den Fehler mit dem Parameter 'errno'
|
|
||||||
'VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR("❌ Ungültiger SQL-Parametername 'errno' – bitte umbenennen.", ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name, , , , , sql)
|
|
||||||
|
|
||||||
ElseIf ex.Message.Contains("Leerer Parametername") Then
|
|
||||||
If showErr Then VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name, , , , , sql)
|
If showErr Then VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name, , , , , sql)
|
||||||
End If
|
|
||||||
End Try
|
End Try
|
||||||
Return False
|
Return False
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function doSQLVarListID(ByVal id As Integer, ByVal sql As String, Optional conn_art As String = "SDL", Optional showErr As Boolean = True, Optional list As List(Of SQLVariable) = Nothing, Optional returnSelectID As Boolean = False, Optional errHinweis As String = "", Optional showErrTimeout As Boolean = True, Optional timeout As Integer = 0) As Integer
|
Public Function doSQLVarListID(ByVal id As Integer, ByVal sql As String, Optional conn_art As String = "SDL", Optional showErr As Boolean = True, Optional list As List(Of SQLVariable) = Nothing, Optional returnSelectID As Boolean = False, Optional errHinweis As String = "", Optional showErrTimeout As Boolean = True, Optional timeout As Integer = 0) As Integer
|
||||||
|
|||||||
Reference in New Issue
Block a user