Hi
I am filling some DataTables which i use for filtering (via binding source) which i then use to populate comboboxes on the form, they all work great except im getting an error on a certain filter and im not sure why.....
Here is the code the error occurs
Code:
'change the column names that are used to more meaningful names for the combo text/value fields
DT.Columns(14).ColumnName = "Text" 'Col FeedYardName
DT.Columns(15).ColumnName = "Value" 'Col FYID
'FeedYard Filter
Dim View As New DataView
View = DT.Select("[Type] IN ('P', 'L', 'M') AND [Value] IS NOT NULL", "[Text] ASC").CopyToDataTable.DefaultView '<---This is the error line
DT_Feedyard = View.ToTable(True, "Text", "Value")
FilterBinder_Feedyard.DataSource = DT_Feedyard
the error im getting is this:
'DT.Select("[Type] IN (' threw an exception of type 'System.InvalidOperationException'
the data in DT at this moment shows empty cells on columns 14 and 15......
i was assuming that this select statement would just return an empty table if the filter criteria where not matched? and i cannot test every record to see exactly where the error occurs
INSIGHT:
the IN() statement is picking up the parent in a multi level table (ie the frst row of the stack) in this particular case the type is L
there is only 1 stack in this table, the first row has type L, the children all have type I. which is what i want, this filter is to filter the parent records....
here is the table
the first item here is the parent and everything under is the child........ my filter should just take column 14,15 values (between O and 12227 which you cannot see here because they are empty)
the Type field is the 4th column, u can see the L and all the I's
- False 12227 L Corn 12227
- False 12227 2769 I Initial C Z7C450 3/7/2017 12:00:00 AM S 50 0.15 87.5 68.5 0.5 O 12227
- False 12227 3377 I Initial C Z7C380 4/28/2017 12:00:00 AM B 30 0.28 52.5 41.1 0.3 O 12227
- False 12227 3462 I Initial C Z8 5/8/2017 12:00:00 AM B 5 3.99 2.75 9.75 0.05 O 12227
- False 12227 3793 I Initial C Z7C450 5/22/2017 12:00:00 AM S 25 0.13 43.75 34.25 0.25 O 12227
- False 12227 4420 I Initial C Z8 8/30/2017 12:00:00 AM B 2 3.875 1.1 3.9 0.02 O 12227
- False 12227 4421 I Initial C Z8 8/30/2017 12:00:00 AM B 2 3.8775 1.1 3.9 0.02 O 12227
- False 12227 4422 I Initial C Z8 8/30/2017 12:00:00 AM B 2 3.8725 1.1 3.9 0.02 O 12227
- False 12227 4423 I Initial C Z8 8/30/2017 12:00:00 AM B 2 3.875 1.1 3.9 0.02 O 12227
- False 12227 4424 I Initial C Z8 8/30/2017 12:00:00 AM B 2 3.8725 1.1 3.9 0.02 O 12227
- False 12227 5138 I Initial C Z8 10/20/2017 12:00:00 AM B 5 3.92 2.75 9.75 0.05 O 12227
- False 12227 5335 I Initial C Z8 11/9/2017 12:00:00 AM B 10 3.91 5.5 19.5 0.1 O 12227
- False 12227 5434 I Initial C Z8 11/22/2017 12:00:00 AM B 10 3.8875 5.5 19.5 0.1 O 12227
- False 12227 5435 I Initial C Z8 11/22/2017 12:00:00 AM B 10 3.8875 5.5 19.5 0.1 O 12227
- False 12227 5436 I Initial C Z8 11/22/2017 12:00:00 AM B 10 3.8875 5.5 19.5 0.1 O 12227
- False 12227 5437 I Initial C Z8 11/22/2017 12:00:00 AM B 10 3.8875 5.5 19.5 0.1 O 12227
- False 12227 5438 I Initial C Z8 11/22/2017 12:00:00 AM B 10 3.8875 5.5 19.5 0.1 O 12227
- False 12227 5439 I Initial C Z8 11/22/2017 12:00:00 AM B 10 3.8875 5.5 19.5 0.1 O 12227
- False 12227 5448 I Initial C Z7C450 11/24/2017 12:00:00 AM B 75 0 0 7.5 0 O 12227
any ideas whats going on here?
This is the actual data too ive not changed anything