MS2909
This commit is contained in:
@@ -39,6 +39,29 @@ Public Class ClassDatabase
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
Public Shared Function Return_Datatable_CS(Select_anweisung As String, ConString As String, Optional userInput As Boolean = False)
|
||||
Try
|
||||
Dim SQLconnect As New SqlClient.SqlConnection
|
||||
Dim SQLcommand As SqlClient.SqlCommand
|
||||
SQLconnect.ConnectionString = ConString
|
||||
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()
|
||||
Return dt
|
||||
Catch ex As Exception
|
||||
If userInput = True Then
|
||||
MsgBox("Error in Return_Datatable_CS - Error-Message:" & vbNewLine & ex.Message & vbNewLine & "SQL-Command:" & vbNewLine & Select_anweisung, MsgBoxStyle.Critical)
|
||||
End If
|
||||
ClassLogger.Add("Fehler bei Return_Datatable_CS: " & 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 SQLconnect As New SqlClient.SqlConnection
|
||||
@@ -105,4 +128,51 @@ Public Class ClassDatabase
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
Public Shared Function OracleExecute_non_Query(ExecuteCMD As String, OracleConnection As String, Optional userInput As Boolean = False)
|
||||
Try
|
||||
Dim SQLconnect As New OracleConnection
|
||||
Dim SQLcommand As OracleCommand
|
||||
SQLconnect.ConnectionString = OracleConnection
|
||||
SQLconnect.Open()
|
||||
SQLcommand = SQLconnect.CreateCommand
|
||||
'Update Last Created Record in Foo
|
||||
SQLcommand.CommandText = ExecuteCMD
|
||||
SQLcommand.ExecuteNonQuery()
|
||||
SQLcommand.Dispose()
|
||||
SQLconnect.Close()
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
If userInput = True Then
|
||||
MsgBox("Error in OracleExecute_non_Query - Error-Message:" & vbNewLine & ex.Message & vbNewLine & "SQL-Command:" & vbNewLine & ExecuteCMD, MsgBoxStyle.Critical)
|
||||
End If
|
||||
ClassLogger.Add("Fehler bei OracleExecute_non_Query: " & ex.Message, True)
|
||||
ClassLogger.Add("#SQL: " & ExecuteCMD, False)
|
||||
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Shared Function Oracle_Return_Datatable(Select_anweisung As String, OracleConnection As String, Optional userInput As Boolean = False)
|
||||
Try
|
||||
Dim SQLconnect As New OracleConnection
|
||||
Dim SQLcommand As OracleCommand
|
||||
SQLconnect.ConnectionString = OracleConnection
|
||||
SQLconnect.Open()
|
||||
SQLcommand = SQLconnect.CreateCommand
|
||||
SQLcommand.CommandText = Select_anweisung
|
||||
|
||||
Dim adapter1 As OracleDataAdapter = New OracleDataAdapter(SQLcommand)
|
||||
Dim dt As DataTable = New DataTable()
|
||||
adapter1.Fill(dt)
|
||||
SQLconnect.Close()
|
||||
Return dt
|
||||
Catch ex As Exception
|
||||
If userInput = True Then
|
||||
MsgBox("Error in Oracle Return Datatable - Error-Message:" & vbNewLine & ex.Message & vbNewLine & "SQL-Command:" & vbNewLine & Select_anweisung, MsgBoxStyle.Critical)
|
||||
End If
|
||||
ClassLogger.Add("Fehler bei Oracle_Return_Datatable: " & ex.Message, True)
|
||||
ClassLogger.Add("#SQL: " & Select_anweisung, False)
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user