MS
This commit is contained in:
@@ -62,7 +62,7 @@ Public Class ClassDatabase
|
||||
SQLconnect.Open()
|
||||
SQLcommand = SQLconnect.CreateCommand
|
||||
SQLcommand.CommandText = Select_anweisung
|
||||
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">>> Execute ReturnDatatable: " & Select_anweisung, False)
|
||||
Dim adapter1 As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(SQLcommand)
|
||||
Dim dt As DataTable = New DataTable()
|
||||
adapter1.Fill(dt)
|
||||
@@ -112,6 +112,7 @@ Public Class ClassDatabase
|
||||
SQLcommand = SQLconnect.CreateCommand
|
||||
'Update Last Created Record in Foo
|
||||
SQLcommand.CommandText = ExecuteCMD
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">>> Execute NonQuery: " & ExecuteCMD, False)
|
||||
SQLcommand.ExecuteNonQuery()
|
||||
SQLcommand.Dispose()
|
||||
SQLconnect.Close()
|
||||
@@ -137,6 +138,7 @@ Public Class ClassDatabase
|
||||
SQLcommand = SQLconnect.CreateCommand
|
||||
'Update Last Created Record in Foo
|
||||
SQLcommand.CommandText = cmdscalar
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(">>> Execute Scalar: " & cmdscalar, False)
|
||||
result = SQLcommand.ExecuteScalar()
|
||||
SQLcommand.Dispose()
|
||||
SQLconnect.Close()
|
||||
|
||||
@@ -2053,31 +2053,43 @@ Public Class frmValidator
|
||||
If value.ToUpper = "SQL-Command".ToUpper Then '###### Indexierung mit variablen SQL ###
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> Indexierung mit dynamischem SQL!", False)
|
||||
Dim SQL_COMMAND = dr.Item("SQL_COMMAND")
|
||||
' Regulären Ausdruck zum Auslesen der Indexe definieren
|
||||
Dim preg As String = "\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}"
|
||||
' einen Regulären Ausdruck laden
|
||||
Dim regulärerAusdruck As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex(preg)
|
||||
' die Vorkommen im SQL-String auslesen
|
||||
Dim elemente As System.Text.RegularExpressions.MatchCollection = regulärerAusdruck.Matches(SQL_COMMAND)
|
||||
'####
|
||||
' alle Vorkommen innerhalbd er Namenkonvention durchlaufen
|
||||
For Each element As System.Text.RegularExpressions.Match In elemente
|
||||
Try
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> element in RegeX: " & element.Value, False)
|
||||
Dim WDINDEXNAME = element.Value.Substring(2, element.Value.Length - 3)
|
||||
Dim wertWD = aktivesDokument.GetVariableValue(WDINDEXNAME)
|
||||
If Not IsNothing(wertWD) Then
|
||||
SQL_COMMAND = SQL_COMMAND.ToString.Replace(element.Value, wertWD)
|
||||
Else
|
||||
ClassLogger.Add(">> Achtung Indexwert ist nothing!", False)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ClassLogger.Add("Unexpected Error in Checking control values for Variable SQL Result - ERROR: " & ex.Message)
|
||||
End Try
|
||||
Next
|
||||
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> SQL_COMMAND before ReplaceAllValues: " & SQL_COMMAND, False)
|
||||
SQL_COMMAND = clsPatterns.ReplaceAllValues(SQL_COMMAND, pnldesigner, aktivesDokument, CURRENT_USER_PRENAME, CURRENT_USER_SURNAME, CURRENT_USER_SHORTNAME, CURRENT_USER_EMAIL)
|
||||
If LogErrorsOnly = False Then ClassLogger.Add(" >> SQL_COMMAND after ReplaceAllValues: " & SQL_COMMAND, False)
|
||||
|
||||
'' Regulären Ausdruck zum Auslesen der Indexe definieren
|
||||
'Dim preg As String = "\[%{1}[a-zA-Z0-9\!\$\&\/\(\)\=\?\,\.\-\;\:_öÖüÜäÄ\#\'\+\*\~\{\}\@\€\<\>\ ]+]{1}"
|
||||
'' einen Regulären Ausdruck laden
|
||||
'Dim regulärerAusdruck As System.Text.RegularExpressions.Regex = New System.Text.RegularExpressions.Regex(preg)
|
||||
'' die Vorkommen im SQL-String auslesen
|
||||
'Dim elemente As System.Text.RegularExpressions.MatchCollection = regulärerAusdruck.Matches(SQL_COMMAND)
|
||||
''####
|
||||
'' alle Vorkommen innerhalbd er Namenkonvention durchlaufen
|
||||
'For Each element As System.Text.RegularExpressions.Match In elemente
|
||||
' Try
|
||||
' If LogErrorsOnly = False Then ClassLogger.Add(" >> element in RegeX: " & element.Value, False)
|
||||
' Dim WDINDEXNAME = element.Value.Substring(2, element.Value.Length - 3)
|
||||
' Dim wertWD = aktivesDokument.GetVariableValue(WDINDEXNAME)
|
||||
' If Not IsNothing(wertWD) Then
|
||||
' SQL_COMMAND = SQL_COMMAND.ToString.Replace(element.Value, wertWD)
|
||||
' Else
|
||||
' ClassLogger.Add(">> Achtung Indexwert ist nothing!", False)
|
||||
' End If
|
||||
' Catch ex As Exception
|
||||
' ClassLogger.Add("Unexpected Error in Checking control values for Variable SQL Result - ERROR: " & ex.Message)
|
||||
' End Try
|
||||
'Next
|
||||
|
||||
|
||||
|
||||
Dim dynamic_value = ClassDatabase.Execute_Scalar(SQL_COMMAND, MyConnectionString, True)
|
||||
|
||||
If Not IsNothing(dynamic_value) Then
|
||||
If LogErrorsOnly = False Then ClassLogger.Add("DYNAMIC VALUE IS: " & dynamic_value.ToString, False)
|
||||
value = dynamic_value
|
||||
Else
|
||||
ClassLogger.Add("ATTENTION: DYNAMIC VALUE IS NOTHING!")
|
||||
End If
|
||||
Else
|
||||
If value.StartsWith("v") Then
|
||||
|
||||
Reference in New Issue
Block a user