MS_04.01
This commit is contained in:
@@ -20,7 +20,7 @@ Public Class ClassDatabase
|
||||
Dim connectionString As String = ""
|
||||
Try
|
||||
'Me.TBCONNECTIONTableAdapter.FillByID(Me.DD_DMSLiteDataSet.TBCONNECTION, id)
|
||||
Dim DTConnection As DataTable = ClassDatabase.Return_Datatable("SELECT * FROM TBDD_CONNECTION WHERE GUID = " & id)
|
||||
Dim DTConnection As DataTable = ClassDatabase.Return_Datatable("SELECT * FROM TBDD_CONNECTION WHERE GUID = " & id, True)
|
||||
If DTConnection.Rows.Count = 1 Then
|
||||
Select Case DTConnection.Rows(0).Item("SQL_PROVIDER")
|
||||
Case "MS-SQLServer"
|
||||
@@ -54,13 +54,21 @@ Public Class ClassDatabase
|
||||
End Try
|
||||
Return connectionString
|
||||
End Function
|
||||
Public Shared Function Return_Datatable(Select_anweisung As String, Optional CallMethod As String = "")
|
||||
Public Shared Function Return_Datatable(Select_anweisung As String, Optional USE_PROXY As Boolean = False)
|
||||
Try
|
||||
Dim sw As New SW("Return_Datatable: " & Select_anweisung)
|
||||
|
||||
Dim SQLconnect As New SqlClient.SqlConnection
|
||||
Dim SQLcommand As SqlClient.SqlCommand
|
||||
SQLconnect.ConnectionString = connectionString
|
||||
If USE_PROXY = True And ClassProxy.MyPROXYConnectionString <> String.Empty Then
|
||||
SQLconnect.ConnectionString = ClassProxy.MyPROXYConnectionString
|
||||
Else
|
||||
SQLconnect.ConnectionString = connectionString
|
||||
End If
|
||||
|
||||
If USE_PROXY = False Then
|
||||
Console.WriteLine(Select_anweisung)
|
||||
End If
|
||||
SQLconnect.Open()
|
||||
SQLcommand = SQLconnect.CreateCommand
|
||||
SQLcommand.CommandText = Select_anweisung
|
||||
@@ -74,9 +82,8 @@ Public Class ClassDatabase
|
||||
|
||||
Return dt
|
||||
Catch ex As Exception
|
||||
MsgBox("Error in Return_Datatable: " & ex.Message & vbNewLine & vbNewLine & Select_anweisung & vbNewLine & vbNewLine & "Call-Method: " & CallMethod, MsgBoxStyle.Critical)
|
||||
ClassLogger.Add("Error in Return_Datatable: " & ex.Message & "Call-Method: " & CallMethod, True)
|
||||
If CallMethod <> "" Then ClassLogger.Add(">> Call-Method: " & CallMethod, False)
|
||||
MsgBox("Error in Return_Datatable: " & ex.Message & vbNewLine & vbNewLine & Select_anweisung, MsgBoxStyle.Critical)
|
||||
ClassLogger.Add("Error in Return_Datatable: " & ex.Message, True)
|
||||
ClassLogger.Add(">> SQL: " & Select_anweisung, False)
|
||||
Return Nothing
|
||||
End Try
|
||||
@@ -180,13 +187,17 @@ Public Class ClassDatabase
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
Public Shared Function Execute_non_Query(ExecuteCMD As String, Optional Userinput As Boolean = False)
|
||||
Public Shared Function Execute_non_Query(ExecuteCMD As String, Optional USE_PROXY As Boolean = False)
|
||||
Try
|
||||
Dim sw As New SW("Execute_non_Query: " & ExecuteCMD)
|
||||
|
||||
Dim SQLconnect As New SqlClient.SqlConnection
|
||||
Dim SQLcommand As SqlClient.SqlCommand
|
||||
SQLconnect.ConnectionString = MyConnectionString
|
||||
If USE_PROXY = True And ClassProxy.MyPROXYConnectionString <> String.Empty Then
|
||||
SQLconnect.ConnectionString = ClassProxy.MyPROXYConnectionString
|
||||
Else
|
||||
SQLconnect.ConnectionString = connectionString
|
||||
End If
|
||||
SQLconnect.Open()
|
||||
SQLcommand = SQLconnect.CreateCommand
|
||||
'Update Last Created Record in Foo
|
||||
@@ -200,9 +211,9 @@ Public Class ClassDatabase
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
If Userinput = True Then
|
||||
MsgBox("Error in Execute_non_Query: " & ex.Message & vbNewLine & vbNewLine & ExecuteCMD, MsgBoxStyle.Critical)
|
||||
End If
|
||||
'If Userinput = True Then
|
||||
' MsgBox("Error in Execute_non_Query: " & ex.Message & vbNewLine & vbNewLine & ExecuteCMD, MsgBoxStyle.Critical)
|
||||
'End If
|
||||
ClassLogger.Add("Error in Execute_non_Query: " & ex.Message, True)
|
||||
ClassLogger.Add("SQL: " & ExecuteCMD, False)
|
||||
Return False
|
||||
@@ -274,14 +285,21 @@ Public Class ClassDatabase
|
||||
ClassLogger.Add(String.Format("Finished executing Async database operation: {0}", command.CommandText), False)
|
||||
End Sub
|
||||
|
||||
Public Shared Function Execute_Scalar(cmdscalar As String, Optional Userinput As Boolean = False)
|
||||
Public Shared Function Execute_Scalar(cmdscalar As String, Optional USE_PROXY As Boolean = False)
|
||||
Dim result
|
||||
Try
|
||||
Dim sw As New SW("Execute_Scalar: " & cmdscalar)
|
||||
|
||||
Dim SQLconnect As New SqlClient.SqlConnection
|
||||
Dim SQLcommand As SqlClient.SqlCommand
|
||||
SQLconnect.ConnectionString = connectionString
|
||||
If USE_PROXY = True And ClassProxy.MyPROXYConnectionString <> String.Empty Then
|
||||
SQLconnect.ConnectionString = ClassProxy.MyPROXYConnectionString
|
||||
Else
|
||||
SQLconnect.ConnectionString = connectionString
|
||||
End If
|
||||
If USE_PROXY = False Then
|
||||
Console.WriteLine(cmdscalar)
|
||||
End If
|
||||
SQLconnect.Open()
|
||||
SQLcommand = SQLconnect.CreateCommand
|
||||
'Update Last Created Record in Foo
|
||||
@@ -294,9 +312,9 @@ Public Class ClassDatabase
|
||||
|
||||
Return result
|
||||
Catch ex As Exception
|
||||
If Userinput = True Then
|
||||
MsgBox("Error in Execute_Scalar: " & ex.Message & vbNewLine & vbNewLine & cmdscalar, MsgBoxStyle.Critical)
|
||||
End If
|
||||
'If Userinput = True Then
|
||||
' MsgBox("Error in Execute_Scalar: " & ex.Message & vbNewLine & vbNewLine & cmdscalar, MsgBoxStyle.Critical)
|
||||
'End If
|
||||
ClassLogger.Add("Error in Execute_Scalar: " & ex.Message, True)
|
||||
ClassLogger.Add("SQL: " & cmdscalar, False)
|
||||
Return Nothing
|
||||
|
||||
Reference in New Issue
Block a user