Try removing GetDouble:
PaidInvoicesBindingSource.Filter = $"WeekNumber LIKE '%{TxtFilterWeek.Text}%'"
or maybe
PaidInvoicesBindingSource.Filter = $"WeekNumber = {FilterWeek}"
Also exclude the erroneous (non-number) values of TxtFilterWeek.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi Good People,
I am trying to write code for searching my Database for week numbers, But I keep getting an error. ( System Data Evaluate Exception). (Filter expression '0' does not evaluate to a Boolean term, )
Does any of you good people know how to search for numeric values using a binding source.
The code I am getting an error with is.
Function GetDouble(s As String) As Double
Dim v As Double = 0.0
If Double.TryParse(s, v) Then Return v
Return 0.0
End Function
Private Sub TxtFilterWeek_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TxtFilterWeek.KeyPress
'Search for week Number
Dim FilterWeek As Double = GetDouble(TxtFilterWeek.Text)
If String.IsNullOrWhiteSpace(TxtFilterWeek.Text) Then
PaidInvoicesBindingSource.Filter = ""
Else
PaidInvoicesBindingSource.Filter = GetDouble($"WeekNumber LIKE '%{TxtFilterWeek.Text}%'")
End If
End Sub
in the database I created the week number is Numeric, (18,0)
Can you point me in the right direction Please
Kindest Regards
Gary
Try removing GetDouble:
PaidInvoicesBindingSource.Filter = $"WeekNumber LIKE '%{TxtFilterWeek.Text}%'"
or maybe
PaidInvoicesBindingSource.Filter = $"WeekNumber = {FilterWeek}"
Also exclude the erroneous (non-number) values of TxtFilterWeek.