DocSearchModul
This commit is contained in:
@@ -83,29 +83,29 @@ Public Class ClassDatabase
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
Public Shared Function Return_Datatable_CS(Select_anweisung As String, Conn_ID As Integer, Optional userInput As Boolean = False)
|
||||
Public Shared Function Return_Datatable_CS(SQLCommand As String, Conn_ID As Integer, Optional userInput As Boolean = False)
|
||||
Try
|
||||
Dim ConString As String = Get_ConnectionString(Conn_ID)
|
||||
LOGGER.Debug(">>> ReturnDatatable: " & Select_anweisung, False)
|
||||
Dim SQLconnect As New SqlClient.SqlConnection
|
||||
Dim SQLcommand As SqlClient.SqlCommand
|
||||
SQLconnect.ConnectionString = ConString
|
||||
SQLconnect.Open()
|
||||
SQLcommand = SQLconnect.CreateCommand
|
||||
SQLcommand.CommandText = Select_anweisung
|
||||
Dim oConString As String = Get_ConnectionString(Conn_ID)
|
||||
LOGGER.Debug(">>> ReturnDatatable: " & SQLCommand, False)
|
||||
Dim oSQLconnect As New SqlClient.SqlConnection
|
||||
Dim oSQLcommand As SqlClient.SqlCommand
|
||||
oSQLconnect.ConnectionString = oConString
|
||||
oSQLconnect.Open()
|
||||
oSQLcommand = oSQLconnect.CreateCommand
|
||||
oSQLcommand.CommandText = SQLCommand
|
||||
|
||||
Dim adapter1 As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(SQLcommand)
|
||||
Dim dt As DataTable = New DataTable()
|
||||
adapter1.Fill(dt)
|
||||
SQLconnect.Close()
|
||||
Return dt
|
||||
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_CS - Error-Message:" & vbNewLine & ex.Message & vbNewLine & "SQL-Command:" & vbNewLine & Select_anweisung, MsgBoxStyle.Critical)
|
||||
MsgBox("Error in Return_Datatable_CS - 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("#SQL: " & Select_anweisung, False)
|
||||
LOGGER.Info("#SQL: " & SQLCommand, False)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Reference in New Issue
Block a user