MS
This commit is contained in:
@@ -145,6 +145,41 @@ Public Class ClassDatabase
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
Public Shared Function Return_Datatable_Connection(Select_anweisung As String, connectionId As Integer, Optional userInput As Boolean = False)
|
||||
Try
|
||||
Dim sw As New SW("Return_Datatable_Connection: " & Select_anweisung)
|
||||
Dim connectionString As String
|
||||
connectionString = ClassDatabase.GetConnectionString(connectionId)
|
||||
If connectionString <> "" Then
|
||||
|
||||
|
||||
Dim SQLconnect As New SqlClient.SqlConnection
|
||||
Dim SQLcommand As SqlClient.SqlCommand
|
||||
SQLconnect.ConnectionString = connectionString
|
||||
SQLconnect.Open()
|
||||
SQLcommand = SQLconnect.CreateCommand
|
||||
SQLcommand.CommandText = Select_anweisung
|
||||
|
||||
Dim adapter1 As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(SQLcommand)
|
||||
Dim dt As DataTable = New DataTable()
|
||||
adapter1.Fill(dt)
|
||||
SQLconnect.Close()
|
||||
sw.Done()
|
||||
|
||||
Return dt
|
||||
Else
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
If userInput = True Then
|
||||
MsgBox("Error in Return_Datatable_Connection - Error-Message:" & vbNewLine & ex.Message & vbNewLine & "SQL-Command:" & vbNewLine & Select_anweisung, MsgBoxStyle.Critical)
|
||||
End If
|
||||
ClassLogger.Add("Error in Return_Datatable_Connection: " & ex.Message, True)
|
||||
ClassLogger.Add("#SQL: " & Select_anweisung, False)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
Public Shared Function Execute_non_Query(ExecuteCMD As String, Optional Userinput As Boolean = False)
|
||||
Try
|
||||
Dim sw As New SW("Execute_non_Query: " & ExecuteCMD)
|
||||
|
||||
Reference in New Issue
Block a user