MS Globix3

This commit is contained in:
2020-11-24 15:08:05 +01:00
parent 3de2f13133
commit 4064c5cd60
13 changed files with 3235 additions and 119 deletions

View File

@@ -49,6 +49,44 @@ Public Class MSSQLServer
Return oConnectionStringBuilder.ToString
End Function
Public Function Get_ConnectionStringforID(pID As Integer)
Dim connectionString As String = ""
Try
'Me.TBCONNECTIONTableAdapter.FillByID(Me.DD_DMSLiteDataSet.TBCONNECTION, id)
Dim oDTConnection As DataTable = GetDatatable("SELECT * FROM TBDD_CONNECTION WHERE GUID = " & pID)
If oDTConnection.Rows.Count = 1 Then
Select Case oDTConnection.Rows(0).Item("SQL_PROVIDER").ToString.ToUpper
Case "MS-SQL"
If oDTConnection.Rows(0).Item("USERNAME") = "WINAUTH" Then
connectionString = "Server=" & oDTConnection.Rows(0).Item("SERVER") & ";Database=" & oDTConnection.Rows(0).Item("DATENBANK") & ";Trusted_Connection=True;"
Else
connectionString = "Server=" & oDTConnection.Rows(0).Item("SERVER") & ";Database=" & oDTConnection.Rows(0).Item("DATENBANK") & ";User Id=" & oDTConnection.Rows(0).Item("USERNAME") & ";Password=" & oDTConnection.Rows(0).Item("USERNAME") & ";Password=" & oDTConnection.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 oDTConnection.Rows(0).Item("BEMERKUNG").ToString.Contains("without tnsnames") Then
connectionString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=" & oDTConnection.Rows(0).Item("SERVER") & ")(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=" &
oDTConnection.Rows(0).Item("DATENBANK") & ")));User Id=" & oDTConnection.Rows(0).Item("USERNAME") & ";Password=" & oDTConnection.Rows(0).Item("PASSWORD") & ";"
Else
connectionString = "Data Source=" & oDTConnection.Rows(0).Item("SERVER") & ";Persist Security Info=True;User Id=" & oDTConnection.Rows(0).Item("USERNAME") & ";Password=" & oDTConnection.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")
End Select
Else
_Logger.Info(" No entry for Connection-ID: " & pID.ToString)
End If
Catch ex As Exception
_Logger.Error(ex)
_Logger.Info(" - Error in bei Get ConnectionString - Fehler: " & vbNewLine & ex.Message)
End Try
Return connectionString
End Function
Private Function TestCanConnect() As Boolean
Return TestCanConnect(CurrentSQLConnectionString)