IDB Conform Step1
This commit is contained in:
@@ -83,13 +83,13 @@ Public Class ClassDatabase
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
Public Shared Function Return_Datatable_CS(SQLCommand As String, Conn_ID As Integer, Optional userInput As Boolean = False)
|
||||
Public Shared Function Return_Datatable_ConId(SQLCommand As String, ConnID As Integer, Optional userInput As Boolean = False)
|
||||
Try
|
||||
Dim oConString As String = Get_ConnectionString(Conn_ID)
|
||||
Dim oConnString = Get_ConnectionString(ConnID)
|
||||
LOGGER.Debug(">>> ReturnDatatable: " & SQLCommand)
|
||||
Dim oSQLconnect As New SqlClient.SqlConnection
|
||||
Dim oSQLcommand As SqlClient.SqlCommand
|
||||
oSQLconnect.ConnectionString = oConString
|
||||
oSQLconnect.ConnectionString = oConnString
|
||||
oSQLconnect.Open()
|
||||
oSQLcommand = oSQLconnect.CreateCommand
|
||||
oSQLcommand.CommandText = SQLCommand
|
||||
@@ -102,9 +102,34 @@ Public Class ClassDatabase
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
If userInput = True Then
|
||||
MsgBox("Error in Return_Datatable_CS - Error-Message:" & vbNewLine & ex.Message & vbNewLine & "SQL-Command:" & vbNewLine & SQLCommand, MsgBoxStyle.Critical)
|
||||
MsgBox("Error in Return_Datatable_ConId - Error-Message:" & vbNewLine & ex.Message & vbNewLine & "SQL-Command:" & vbNewLine & SQLCommand, MsgBoxStyle.Critical)
|
||||
End If
|
||||
LOGGER.Info("Fehler bei Return_Datatable_CS: " & ex.Message, True)
|
||||
LOGGER.Info("Fehler bei Return_Datatable_ConId: " & ex.Message, True)
|
||||
LOGGER.Info("#SQL: " & SQLCommand, False)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
Public Shared Function Return_Datatable_ConStr(SQLCommand As String, ConNStr As String, Optional userInput As Boolean = False)
|
||||
Try
|
||||
LOGGER.Debug(">>> ReturnDatatable: " & SQLCommand)
|
||||
Dim oSQLconnect As New SqlClient.SqlConnection
|
||||
Dim oSQLcommand As SqlClient.SqlCommand
|
||||
oSQLconnect.ConnectionString = ConNStr
|
||||
oSQLconnect.Open()
|
||||
oSQLcommand = oSQLconnect.CreateCommand
|
||||
oSQLcommand.CommandText = SQLCommand
|
||||
|
||||
Dim oSQLAdapter As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(oSQLcommand)
|
||||
Dim oReturnDatatable As DataTable = New DataTable()
|
||||
oSQLAdapter.Fill(oReturnDatatable)
|
||||
oSQLconnect.Close()
|
||||
Return oReturnDatatable
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
If userInput = True Then
|
||||
MsgBox("Error in Return_Datatable_ConStr - Error-Message:" & vbNewLine & ex.Message & vbNewLine & "SQL-Command:" & vbNewLine & SQLCommand, MsgBoxStyle.Critical)
|
||||
End If
|
||||
LOGGER.Info("Fehler bei Return_Datatable_ConStr: " & ex.Message, True)
|
||||
LOGGER.Info("#SQL: " & SQLCommand, False)
|
||||
Return Nothing
|
||||
End Try
|
||||
@@ -114,12 +139,11 @@ Public Class ClassDatabase
|
||||
Dim SQLconnect As New SqlClient.SqlConnection
|
||||
Dim SQLcommand As SqlClient.SqlCommand
|
||||
SQLconnect.ConnectionString = SQLSERVERConnectionString
|
||||
LOGGER.Debug(">>> Execute_non_Query: " & ExecuteCMD)
|
||||
SQLconnect.Open()
|
||||
SQLcommand = SQLconnect.CreateCommand
|
||||
'Update Last Created Record in Foo
|
||||
SQLcommand.CommandText = ExecuteCMD
|
||||
LOGGER.Debug(">>> Execute NonQuery: " & ExecuteCMD)
|
||||
LOGGER.Debug("Execute_Command Created: " & ExecuteCMD)
|
||||
SQLcommand.ExecuteNonQuery()
|
||||
SQLcommand.Dispose()
|
||||
SQLconnect.Close()
|
||||
@@ -136,13 +160,65 @@ Public Class ClassDatabase
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
Public Shared Function Execute_non_Query_ConStr(ExecuteCMD As String, ConnString As String, Optional userInput As Boolean = False)
|
||||
Try
|
||||
Dim SQLconnect As New SqlClient.SqlConnection
|
||||
Dim SQLcommand As SqlClient.SqlCommand
|
||||
SQLconnect.ConnectionString = ConnString
|
||||
SQLconnect.Open()
|
||||
SQLcommand = SQLconnect.CreateCommand
|
||||
'Update Last Created Record in Foo
|
||||
SQLcommand.CommandText = ExecuteCMD
|
||||
LOGGER.Debug("Execute_Command Created: " & ExecuteCMD)
|
||||
SQLcommand.ExecuteNonQuery()
|
||||
SQLcommand.Dispose()
|
||||
SQLconnect.Close()
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
If userInput = True Then
|
||||
MsgBox("Error in Execute_non_Query_ConStr - Error-Message:" & vbNewLine & ex.Message & vbNewLine & "SQL-Command:" & vbNewLine & ExecuteCMD, MsgBoxStyle.Critical)
|
||||
End If
|
||||
Clipboard.SetText("Error Execute_non_Query_ConStr: " & ex.Message & vbNewLine & "SQL: " & ExecuteCMD)
|
||||
LOGGER.Info("Fehler bei Execute_non_Query_ConStr: " & ex.Message, True)
|
||||
LOGGER.Info("#SQL: " & ExecuteCMD, False)
|
||||
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
Public Shared Function Execute_Scalar(cmdscalar As String, ConString As String, Optional userInput As Boolean = False)
|
||||
Dim result
|
||||
Try
|
||||
Dim SQLconnect As New SqlClient.SqlConnection
|
||||
Dim SQLcommand As SqlClient.SqlCommand
|
||||
SQLconnect.ConnectionString = ConString
|
||||
LOGGER.Debug(">>> Execute_non_Query: " & cmdscalar)
|
||||
|
||||
SQLconnect.Open()
|
||||
SQLcommand = SQLconnect.CreateCommand
|
||||
'Update Last Created Record in Foo
|
||||
SQLcommand.CommandText = cmdscalar
|
||||
LOGGER.Debug("Execute_non_Query: " & cmdscalar)
|
||||
result = SQLcommand.ExecuteScalar()
|
||||
SQLcommand.Dispose()
|
||||
SQLconnect.Close()
|
||||
Return result
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
If userInput = True Then
|
||||
MsgBox("Error in Execute Scalar - Error-Message:" & vbNewLine & ex.Message & vbNewLine & "SQL-Command:" & vbNewLine & cmdscalar, MsgBoxStyle.Critical)
|
||||
End If
|
||||
Clipboard.SetText("Error Execute_Scalar: " & ex.Message & vbNewLine & "SQL: " & cmdscalar)
|
||||
LOGGER.Info("Fehler bei Execute_Scalar: " & ex.Message, True)
|
||||
LOGGER.Info("#SQL: " & cmdscalar, False)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
Public Shared Function Execute_Scalar_ConStr(cmdscalar As String, ConString As String, Optional userInput As Boolean = False)
|
||||
Dim result
|
||||
Try
|
||||
Dim SQLconnect As New SqlClient.SqlConnection
|
||||
Dim SQLcommand As SqlClient.SqlCommand
|
||||
SQLconnect.ConnectionString = ConString
|
||||
SQLconnect.Open()
|
||||
SQLcommand = SQLconnect.CreateCommand
|
||||
'Update Last Created Record in Foo
|
||||
@@ -155,10 +231,10 @@ Public Class ClassDatabase
|
||||
Catch ex As Exception
|
||||
LOGGER.Error(ex)
|
||||
If userInput = True Then
|
||||
MsgBox("Error in Execute Scalar - Error-Message:" & vbNewLine & ex.Message & vbNewLine & "SQL-Command:" & vbNewLine & cmdscalar, MsgBoxStyle.Critical)
|
||||
MsgBox("Error in Execute_Scalar_ConStr - Error-Message:" & vbNewLine & ex.Message & vbNewLine & "SQL-Command:" & vbNewLine & cmdscalar, MsgBoxStyle.Critical)
|
||||
End If
|
||||
Clipboard.SetText("Error Execute_Scalar: " & ex.Message & vbNewLine & "SQL: " & cmdscalar)
|
||||
LOGGER.Info("Fehler bei Execute_Scalar: " & ex.Message, True)
|
||||
Clipboard.SetText("Error Execute_Scalar_ConStr: " & ex.Message & vbNewLine & "SQL: " & cmdscalar)
|
||||
LOGGER.Info("Fehler bei Execute_Scalar_ConStr: " & ex.Message, True)
|
||||
LOGGER.Info("#SQL: " & cmdscalar, False)
|
||||
Return Nothing
|
||||
End Try
|
||||
|
||||
Reference in New Issue
Block a user