ms connection
This commit is contained in:
@@ -39,7 +39,7 @@ Public Class frmConnections
|
||||
chkOR_ohne_TNS.Visible = False
|
||||
Select Case Me.SQL_PROVIDERComboBox.SelectedItem
|
||||
|
||||
Case ("MS-SQL".ToUpper Or "MS-SQLServer".ToUpper)
|
||||
Case "MS-SQL".ToUpper
|
||||
If USER_LANGUAGE = "de-DE" Then
|
||||
Me.lblDataSource.Text = "Datenbank-Server (IP-Adresse oder Name)*:"
|
||||
Me.lblInitialCatalog.Text = "Datenbank-Name:"
|
||||
@@ -61,6 +61,29 @@ Public Class frmConnections
|
||||
Me.cmbInitialCatalog.Visible = True
|
||||
Me.lblDatenbank.Visible = True
|
||||
CheckBoxwin_aut.Visible = True
|
||||
Case "MS-SQLServer".ToUpper
|
||||
If USER_LANGUAGE = "de-DE" Then
|
||||
Me.lblDataSource.Text = "Datenbank-Server (IP-Adresse oder Name)*:"
|
||||
Me.lblInitialCatalog.Text = "Datenbank-Name:"
|
||||
Me.lblUserId.Text = "UserId:"
|
||||
Me.lblPassword.Text = "Passwort:"
|
||||
Else
|
||||
Me.lblDataSource.Text = "Database-Server (IP-Adress or Name)*:"
|
||||
Me.lblInitialCatalog.Text = "Database-Name:"
|
||||
Me.lblUserId.Text = "UserId:"
|
||||
Me.lblPassword.Text = "Passwort:"
|
||||
End If
|
||||
|
||||
Me.SERVERTextBox.ReadOnly = False
|
||||
Me.SERVERTextBox.BackColor = System.Drawing.SystemColors.Window
|
||||
Me.SERVERTextBox.Text = ""
|
||||
|
||||
Me.lblInitialCatalog.Visible = False
|
||||
Me.DATENBANKTextBox.Visible = False
|
||||
Me.cmbInitialCatalog.Visible = True
|
||||
Me.lblDatenbank.Visible = True
|
||||
CheckBoxwin_aut.Visible = True
|
||||
|
||||
Case "Oracle"
|
||||
If USER_LANGUAGE = "de-DE" Then
|
||||
Me.lblDataSource.Text = "IP Oracle-Server:"
|
||||
@@ -128,7 +151,28 @@ Public Class frmConnections
|
||||
Cursor = Cursors.WaitCursor
|
||||
|
||||
Select Case Me.SQL_PROVIDERComboBox.SelectedItem
|
||||
Case ("MS-SQL".ToUpper Or "MS-SQLServer".ToUpper)
|
||||
Case "MS-SQL".ToUpper
|
||||
Dim con As String
|
||||
If CheckBoxwin_aut.Checked Then
|
||||
con = "Data Source=" & Me.SERVERTextBox.Text & ";Initial Catalog=" & Me.cmbInitialCatalog.Text & ";Trusted_Connection=True;"
|
||||
Else
|
||||
con = "Server=" & Me.SERVERTextBox.Text & ";Database=" & Me.cmbInitialCatalog.Text & ";User Id=" & Me.USERNAMETextBox.Text & ";Password=" & Me.PASSWORDTextBox.Text & ";"
|
||||
End If
|
||||
msg_string = con
|
||||
Dim connection As New SqlClient.SqlConnection(con)
|
||||
connection.Open()
|
||||
Cursor = Cursors.Default
|
||||
|
||||
|
||||
If USER_LANGUAGE = "de-DE" Then
|
||||
MsgBox("Die SQL-Server Verbindung wurde erfolgreich aufgebaut!", MsgBoxStyle.Information, "Erfolg:")
|
||||
Else
|
||||
MsgBox("Connection to Server successfully established!", MsgBoxStyle.Information, "Success:")
|
||||
End If
|
||||
|
||||
|
||||
My.Settings.Save()
|
||||
Case "MS-SQLServer".ToUpper
|
||||
Dim con As String
|
||||
If CheckBoxwin_aut.Checked Then
|
||||
con = "Data Source=" & Me.SERVERTextBox.Text & ";Initial Catalog=" & Me.cmbInitialCatalog.Text & ";Trusted_Connection=True;"
|
||||
@@ -149,7 +193,6 @@ Public Class frmConnections
|
||||
|
||||
|
||||
My.Settings.Save()
|
||||
'DialogResult = Windows.Forms.DialogResult.OK
|
||||
Case "Oracle"
|
||||
My.Settings.Save()
|
||||
Dim connstr As String
|
||||
@@ -209,7 +252,35 @@ Public Class frmConnections
|
||||
If Me.SQL_PROVIDERComboBox.SelectedIndex <> -1 Then
|
||||
|
||||
Select Case Me.SQL_PROVIDERComboBox.SelectedItem
|
||||
Case ("MS-SQL".ToUpper Or "MS-SQLServer".ToUpper)
|
||||
Case "MS-SQL".ToUpper
|
||||
Dim con As String
|
||||
If CheckBoxwin_aut.Checked Then
|
||||
con = "Data Source=" & Me.SERVERTextBox.Text & ";Initial Catalog=" & Me.cmbInitialCatalog.Text & ";Trusted_Connection=True;"
|
||||
Else
|
||||
con = "Server=" & Me.SERVERTextBox.Text & ";Database=" & Me.cmbInitialCatalog.Text & ";User Id=" & Me.USERNAMETextBox.Text & ";Password=" & Me.PASSWORDTextBox.Text & ";"
|
||||
End If
|
||||
'csb.DataSource = Me.txtDataSource.Text
|
||||
'csb.IntegratedSecurity = False
|
||||
'csb.UserID = Me.txtUserId.Text
|
||||
'csb.Password = Me.txtPassword.Text
|
||||
Dim connection As New SqlClient.SqlConnection(con)
|
||||
'während Verbindungsaufbau Sanduhr-Mauszeiger
|
||||
Cursor = Cursors.WaitCursor
|
||||
connection.Open()
|
||||
Cursor = Cursors.Default
|
||||
' SQLCommand-Objekt über alle Datenbanken erstellen
|
||||
Dim cmd As New SqlClient.SqlCommand("SELECT [name] FROM master.dbo.sysdatabases WHERE name NOT IN ('master', 'tempdb', 'model', 'msdb')", connection)
|
||||
'cmd.CommandType = CommandType.
|
||||
' Ausführen und Ergebnis in einer ListBox anzeigen
|
||||
Dim dr As SqlClient.SqlDataReader = cmd.ExecuteReader
|
||||
If dr.HasRows Then
|
||||
cmbInitialCatalog.Items.Clear()
|
||||
Do While dr.Read
|
||||
cmbInitialCatalog.Items.Add(dr("name"))
|
||||
Loop
|
||||
cmbInitialCatalog.DroppedDown = True
|
||||
End If
|
||||
Case "MS-SQLServer".ToUpper
|
||||
Dim con As String
|
||||
If CheckBoxwin_aut.Checked Then
|
||||
con = "Data Source=" & Me.SERVERTextBox.Text & ";Initial Catalog=" & Me.cmbInitialCatalog.Text & ";Trusted_Connection=True;"
|
||||
|
||||
Reference in New Issue
Block a user