handle errors in sql queries for table columns
This commit is contained in:
parent
0a7cfbc35e
commit
20dc259f92
@ -477,6 +477,10 @@ Public Class ClassControlCreator
|
|||||||
Try
|
Try
|
||||||
Dim oComboboxDataTable As DataTable = ClassDatabase.Return_Datatable_ConId(oSqlCommand, oConnectionId)
|
Dim oComboboxDataTable As DataTable = ClassDatabase.Return_Datatable_ConId(oSqlCommand, oConnectionId)
|
||||||
|
|
||||||
|
If oComboboxDataTable Is Nothing Then
|
||||||
|
LOGGER.Warn("DataTable for SQL [{0}] is nothing. Possible error on SQL Query.")
|
||||||
|
End If
|
||||||
|
|
||||||
GridTables.Item(oControl.Name).Add(oRow.Item("SPALTENNAME"), oComboboxDataTable)
|
GridTables.Item(oControl.Name).Add(oRow.Item("SPALTENNAME"), oComboboxDataTable)
|
||||||
'GridTables.Add(oRow.Item("SPALTENNAME"), oComboboxDataTable)
|
'GridTables.Add(oRow.Item("SPALTENNAME"), oComboboxDataTable)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
@ -503,50 +507,68 @@ Public Class ClassControlCreator
|
|||||||
Next
|
Next
|
||||||
|
|
||||||
AddHandler oView.CustomRowCellEdit, Sub(sender As Object, e As CustomRowCellEditEventArgs)
|
AddHandler oView.CustomRowCellEdit, Sub(sender As Object, e As CustomRowCellEditEventArgs)
|
||||||
For Each oRow As DataRow In DT_MY_COLUMNS.Rows
|
Try
|
||||||
If oRow.Item("SPALTENNAME") = e.Column.FieldName Then
|
For Each oRow As DataRow In DT_MY_COLUMNS.Rows
|
||||||
If GridTables.Item(oControl.Name).ContainsKey(e.Column.FieldName) Then
|
If oRow.Item("SPALTENNAME") = e.Column.FieldName Then
|
||||||
Dim oComboboxDataTable As DataTable = GridTables.Item(oControl.Name).Item(e.Column.FieldName)
|
If GridTables.Item(oControl.Name).ContainsKey(e.Column.FieldName) Then
|
||||||
|
Dim oComboboxDataTable As DataTable = GridTables.Item(oControl.Name).Item(e.Column.FieldName)
|
||||||
|
|
||||||
If oRow.Item("ADVANCED_LOOKUP") Then
|
If oComboboxDataTable Is Nothing Then
|
||||||
Dim oEditor = New RepositoryItemLookupControl3 With {
|
Throw New ApplicationException($"ComboboxTable for Column {e.Column.FieldName} is empty.")
|
||||||
.DataSource = oComboboxDataTable,
|
End If
|
||||||
.DisplayMember = oComboboxDataTable.Columns.Item(0).ColumnName,
|
|
||||||
.ValueMember = oComboboxDataTable.Columns.Item(0).ColumnName
|
|
||||||
}
|
|
||||||
|
|
||||||
e.RepositoryItem = oEditor
|
If oRow.Item("ADVANCED_LOOKUP") And oComboboxDataTable IsNot Nothing Then
|
||||||
Else
|
Dim oEditor = New RepositoryItemLookupControl3 With {
|
||||||
Dim oEditor = New RepositoryItemComboBox()
|
.DataSource = oComboboxDataTable,
|
||||||
Dim oItems As New List(Of String)
|
.DisplayMember = oComboboxDataTable.Columns.Item(0).ColumnName,
|
||||||
|
.ValueMember = oComboboxDataTable.Columns.Item(0).ColumnName
|
||||||
|
}
|
||||||
|
|
||||||
AddHandler oEditor.Validating, Sub(_sender As ComboBoxEdit, _e As CancelEventArgs)
|
|
||||||
If oItems.Contains(_sender.EditValue) Then
|
|
||||||
_e.Cancel = False
|
|
||||||
Else
|
|
||||||
_e.Cancel = True
|
|
||||||
End If
|
|
||||||
|
|
||||||
End Sub
|
'AddHandler oEditor.SelectedValuesChanged, Sub(_sender As Object, _e As List(Of String))
|
||||||
For Each oRow2 As DataRow In oComboboxDataTable.Rows
|
' oView.PostEditor()
|
||||||
Dim oValue = oRow2.Item(0)
|
' End Sub
|
||||||
|
|
||||||
Try
|
e.RepositoryItem = oEditor
|
||||||
oValue &= $" | {oRow2.Item(1)}"
|
Else
|
||||||
Catch ex As Exception
|
Dim oEditor = New RepositoryItemComboBox()
|
||||||
End Try
|
Dim oItems As New List(Of String)
|
||||||
|
|
||||||
oEditor.Items.Add(oValue)
|
AddHandler oEditor.Validating, Sub(_sender As ComboBoxEdit, _e As CancelEventArgs)
|
||||||
oItems.Add(oValue)
|
If oItems.Contains(_sender.EditValue) Then
|
||||||
Next
|
_e.Cancel = False
|
||||||
|
Else
|
||||||
|
_e.Cancel = True
|
||||||
|
End If
|
||||||
|
|
||||||
e.RepositoryItem = oEditor
|
End Sub
|
||||||
|
For Each oRow2 As DataRow In oComboboxDataTable.Rows
|
||||||
|
Dim oValue = oRow2.Item(0)
|
||||||
|
|
||||||
|
Try
|
||||||
|
oValue &= $" | {oRow2.Item(1)}"
|
||||||
|
Catch ex As Exception
|
||||||
|
End Try
|
||||||
|
|
||||||
|
oEditor.Items.Add(oValue)
|
||||||
|
oItems.Add(oValue)
|
||||||
|
Next
|
||||||
|
|
||||||
|
e.RepositoryItem = oEditor
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
Next
|
||||||
Next
|
Catch ex As Exception
|
||||||
|
LOGGER.Warn("Error in CustomRowCellEdit for [{0}]", e.CellValue)
|
||||||
|
LOGGER.Error(ex)
|
||||||
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
'AddHandler oView.CellValueChanged, Sub(sender As Object, e As CellValueChangedEventArgs)
|
||||||
|
' Console.WriteLine("")
|
||||||
|
' End Sub
|
||||||
|
|
||||||
AddHandler oView.ValidateRow, Sub(sender As Object, e As ValidateRowEventArgs)
|
AddHandler oView.ValidateRow, Sub(sender As Object, e As ValidateRowEventArgs)
|
||||||
Dim oRow As DataRowView = oView.GetRow(oView.FocusedRowHandle)
|
Dim oRow As DataRowView = oView.GetRow(oView.FocusedRowHandle)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user