add new Setup, add new SQL Designer

This commit is contained in:
Jonathan Jenne
2020-02-06 16:33:50 +01:00
parent c8e23e3ca0
commit f0ccea072f
12 changed files with 1909 additions and 4 deletions

View File

@@ -22,6 +22,46 @@ Public Class ClassDatabase
End Try
End Function
Public Shared Function Get_ConnectionString(id As Integer)
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)
If DTConnection.Rows.Count = 1 Then
Select Case DTConnection.Rows(0).Item("SQL_PROVIDER").ToString.ToUpper
Case "MS-SQL"
If DTConnection.Rows(0).Item("USERNAME") = "WINAUTH" Then
connectionString = "Server=" & DTConnection.Rows(0).Item("SERVER") & ";Database=" & DTConnection.Rows(0).Item("DATENBANK") & ";Trusted_Connection=True;"
Else
connectionString = "Server=" & DTConnection.Rows(0).Item("SERVER") & ";Database=" & DTConnection.Rows(0).Item("DATENBANK") & ";User Id=" & DTConnection.Rows(0).Item("USERNAME") & ";Password=" & DTConnection.Rows(0).Item("USERNAME") & ";Password=" & DTConnection.Rows(0).Item("PASSWORD") & ";"
End If
' connectionString = "Server=" & DTConnection.Rows(0).Item("SERVER") & ";Database=" & DTConnection.Rows(0).Item("DATENBANK") & ";User Id=" & DTConnection.Rows(0).Item("USERNAME") & ";Password=" & DTConnection.Rows(0).Item("PASSWORD") & ";"
Case "Oracle"
If DTConnection.Rows(0).Item("BEMERKUNG").ToString.Contains("without tnsnames") Then
connectionString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=" & DTConnection.Rows(0).Item("SERVER") & ")(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=" &
DTConnection.Rows(0).Item("DATENBANK") & ")));User Id=" & DTConnection.Rows(0).Item("USERNAME") & ";Password=" & DTConnection.Rows(0).Item("PASSWORD") & ";"
Else
connectionString = "Data Source=" & DTConnection.Rows(0).Item("SERVER") & ";Persist Security Info=True;User Id=" & DTConnection.Rows(0).Item("USERNAME") & ";Password=" & DTConnection.Rows(0).Item("PASSWORD") & ";Unicode=True"
End If
'Case "ODBC"
' Dim conn As New OdbcConnection("dsn=" & DTConnection.Rows(0).Item("SERVER") & ";uid=" & DTConnection.Rows(0).Item("USERNAME") & ";pwd=" + DTConnection.Rows(0).Item("PASSWORD"))
' connectionString = conn.ConnectionString
Case Else
LOGGER.Info(" - ConnectionType nicht integriert", False)
MsgBox("ConnectionType nicht integriert", MsgBoxStyle.Critical, "Bitte Konfiguration Connection überprüfen!")
End Select
Else
LOGGER.Info(" No entry for Connection-ID: " & id.ToString, True)
End If
Catch ex As Exception
LOGGER.Error(ex)
LOGGER.Info(" - Error in bei Get ConnectionString - Fehler: " & vbNewLine & ex.Message)
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error in Get ConnectionString:")
End Try
Return connectionString
End Function
Public Shared Function Return_Datatable(sql_command As String, Optional userInput As Boolean = False)
Try
Dim SQLconnect As New SqlConnection