MS_10.11.2015

This commit is contained in:
SchreiberM
2015-11-10 09:41:29 +01:00
parent 317a223c68
commit 2aa4e4ba58
15 changed files with 141 additions and 125 deletions

View File

@@ -32,9 +32,15 @@ Public Class frmSQLEditor
End Sub
Private Sub Load_Connections()
'TODO: Diese Codezeile lädt Daten in die Tabelle "DD_DMSDataSet.TBDD_CONNECTION". Sie können sie bei Bedarf verschieben oder entfernen.
Me.TBDD_CONNECTIONTableAdapter.Connection.ConnectionString = MyConnectionString
Me.TBDD_CONNECTIONTableAdapter.Fill(Me.DD_DMSDataSet.TBDD_CONNECTION)
Try
'TODO: Diese Codezeile lädt Daten in die Tabelle "DD_DMSDataSet.TBDD_CONNECTION". Sie können sie bei Bedarf verschieben oder entfernen.
Me.TBDD_CONNECTIONTableAdapter.Connection.ConnectionString = MyConnectionString
Me.TBDD_CONNECTIONTableAdapter.Fill(Me.DD_DMSDataSet.TBDD_CONNECTION)
Catch ex As Exception
ClassLogger.Add(" - Unexpected Error in Load Connections - errpor: " & vbNewLine & ex.Message)
MsgBox("Unexpected Error in Load Connections: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
@@ -108,12 +114,11 @@ Public Class frmSQLEditor
Dim connectionString As String
connectionString = ClassHelper.GetConnectionString(connectionId)
connectionString = ClassDatabase.GetConnectionString(connectionId)
If connectionString <> "" Then
If connectionString.Contains("Initial Catalog=") Then
If connectionString.StartsWith("Server=") And connectionString.Contains("Database=") Then
Dim sqlConnection As SqlClient.SqlConnection
Dim sqlCommand As SqlClient.SqlCommand
Dim sqlAdapter As New SqlClient.SqlDataAdapter
@@ -125,10 +130,11 @@ Public Class frmSQLEditor
sqlCommand = New SqlClient.SqlCommand(sql, sqlConnection)
sqlAdapter.SelectCommand = sqlCommand
sqlAdapter.Fill(Dataset)
sqlAdapter.Fill(dataset)
Return dataset
Else
If LogErrorsOnly = True Then ClassLogger.Add(" >> It's an Oracle-Connection (ExecuteWithConnection)", False)
Dim sqlConnection As OracleConnection
Dim sqlCommand As OracleCommand
Dim sqlAdapter As New OracleDataAdapter
@@ -140,7 +146,7 @@ Public Class frmSQLEditor
sqlCommand = New OracleCommand(sql, sqlConnection)
sqlAdapter.SelectCommand = sqlCommand
sqlAdapter.Fill(Dataset)
sqlAdapter.Fill(dataset)
Return dataset
End If
@@ -284,4 +290,43 @@ Public Class frmSQLEditor
txtValue.Text = sql
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Try
Dim upd As String = "UPDATE TBPMO_CONTROL SET SQL_COMMAND_1 = '" & txtValue.Text & "', CONNECTION_ID_1 = " & cmbConnection.SelectedValue & ", CHANGED_WHO = '" & Environment.UserName & "' WHERE GUID = " & CURRENT_CONTROL_ID
If ClassDatabase.Execute_non_Query(upd, True) Then
MsgBox("SQL-Befehl erfolgreich gespeichert!", MsgBoxStyle.Exclamation)
End If
Catch ex As Exception
ClassLogger.Add(" - Unexpected Error in Save SQL-Command for control - error: " & vbNewLine & ex.Message)
MsgBox("Unexpected Error in Save SQL-Command for control - error: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub frmSQLEditor_Shown(sender As Object, e As EventArgs) Handles Me.Shown
Try
Dim connsql = "SELECT BEZEICHNUNG FROM TBDD_CONNECTION WHERE GUID = (SELECT CONNECTION_ID_1 FROM TBPMO_CONTROL WHERE GUID = " & CURRENT_CONTROL_ID & ")"
Dim con_name = ClassDatabase.Execute_Scalar(connsql, True)
If IsDBNull(con_name) Then
If Me.DD_DMSDataSet.TBDD_CONNECTION.Rows.Count > 0 Then
cmbConnection.SelectedIndex = 0
End If
Else
If IsNothing(con_name) Then
If Me.DD_DMSDataSet.TBDD_CONNECTION.Rows.Count > 0 Then
cmbConnection.SelectedIndex = 0
End If
Else
cmbConnection.SelectedIndex = cmbConnection.FindStringExact(con_name)
End If
End If
Catch ex As Exception
ClassLogger.Add(" - Unexpected Error in Get Connection for Control - error: " & vbNewLine & ex.Message)
MsgBox("Unexpected Error in Get Connection for Control - error: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
End Sub
End Class