fix sql not being saved on new man index

This commit is contained in:
Jonathan Jenne
2020-07-03 11:55:29 +02:00
parent 8d2e5be621
commit ebf08aa141
3 changed files with 2030 additions and 856 deletions

View File

@@ -466,37 +466,29 @@ Public Class frmAdministration
End Sub
Private Sub btnSQLView_Click(sender As Object, e As EventArgs) Handles btnSQLView.Click
Save_IndexMan()
'CURRENT_INDEXMAN = GUIDTextBox1.Text
'frmSQLSuggestion.ShowDialog()
Dim oIndexGuid As Integer = GUIDTextBox1.Text
Dim oDocTypeGuid As Integer = DOKART_GUIDTextBox.Text
Dim oSQLCommand = ""
Try
Dim oSQL = $"SELECT SQL_RESULT, CONNECTION_ID FROM TBDD_INDEX_MAN WHERE GUID = {oIndexGuid}"
Dim oDatatable As DataTable = ClassDatabase.Return_Datatable(oSQL)
Dim oRow = oDatatable.Rows.Item(0)
Dim oConnection As Integer = 1
Dim oSQLCommand = ""
If Not IsDBNull(oRow.Item("CONNECTION_ID")) Then
oConnection = oRow.Item("CONNECTION_ID")
If txtManIndexConnectionId.Text <> String.Empty Then
oConnection = txtManIndexConnectionId.Text
End If
If txtManIndexSQL.Text <> String.Empty Then
oSQLCommand = txtManIndexSQL.Text
End If
Dim oForm As New frmSQL_DESIGNER(oIndexGuid, oDocTypeGuid) With {
.SQLCommand = oRow.Item("SQL_RESULT"),
.SQLCommand = oSQLCommand,
.ConnectionID = oConnection
}
If oForm.ShowDialog() = DialogResult.OK Then
oSQLCommand = oForm.SQLCommand.Replace("'", "''")
Dim oConnectionId = oForm.SQLConnectionId
oSQL = $"UPDATE TBDD_INDEX_MAN SET CONNECTION_ID = {oConnectionId},SQL_RESULT = '{oSQLCommand}',CHANGED_WHO = '{Environment.UserName}' WHERE GUID = {oIndexGuid}"
ClassDatabase.Execute_non_Query(oSQL, True)
txtManIndexSQL.Text = oForm.SQLCommand
txtManIndexConnectionId.Text = oForm.SQLConnectionId
End If
Catch ex As Exception
LOGGER.Error(ex)