问题描述
我有一个包含高尔夫比赛结果的数据视图。我希望根据让分将结果分成三个部分
我有两个全局变量:
GlobalVariables.DivNo
和
GlobalVariables.DivNo2
从csv文件中定义为16和20
对于第一个分部,我的代码令人满意,是
Dim LowHandi As String = GlobalVariables.DivNo + 1
MResultsDV.RowFilter =Handicap< &安培; LowHandi
第三个分区代码,也能令人满意地工作,是
MResultsDV.RowFilter =让分> &安培; GlobalVariables.DivNo2
但是我的代码需要过滤17到20之间的差点结果不起作用。
什么我试过了:
我的第一次尝试是
Dim HighHandi As String = GlobalVariables.DivNo2 + 1
MResultsDV.RowFilter =让分> &安培; GlobalVariables.DivNo
MResultsDV.RowFilter =Handicap< &安培; HighHandi
然而,最后一个过滤器写了第一个。
所以,我试过
Dim HighHandi As String = GlobalVariables .DivNo2 + 1
MResultsDV.RowFilter =让分> &安培; GlobalVariables.DivNo和Handicap< &安培; HighHandi
但出现以下错误;
System.InvalidCastException:'从字符串Handicap> 16转换为Long类型无效。'
然后我尝试了
Dim HighHandi As String = GlobalVariables.DivNo2 + 1
MResultsDV.RowFilter =Handicap> &安培; GlobalVariables.DivNo AndAlsoHandicap< &安培; HighHandi
但是出现了这个错误; System.InvalidCastException:'从字符串Handicap> 16转换为'Boolean'类型无效。'
我也试过
MResultsDV .RowFilter ='让分> &安培; GlobalVariables.DivNo'和'障碍< &安培;运行但不起作用的HighHandi'
请按照我提供的链接。
I have a dataview containing the results of a golf competition. I wish to split the results into three divisions based on "Handicap"
I have two Global Variables namely:
GlobalVariables.DivNo
and
GlobalVariables.DivNo2
which are defined from a csv file as 16 and 20
For the first Division my code, which works satisfactorily, is
Dim LowHandi As String = GlobalVariables.DivNo + 1 MResultsDV.RowFilter = "Handicap <" & LowHandi
the third Division code, which also works satisfactorily, is
MResultsDV.RowFilter = "Handicap >" & GlobalVariables.DivNo2
However my code which needs to filter out the results for handicaps between 17 and 20 does not work.
What I have tried:
My first try was
Dim HighHandi As String = GlobalVariables.DivNo2 + 1 MResultsDV.RowFilter = "Handicap >" & GlobalVariables.DivNo MResultsDV.RowFilter = "Handicap <" & HighHandi
However, the last filter over wrote the first.
So, I tried
Dim HighHandi As String = GlobalVariables.DivNo2 + 1 MResultsDV.RowFilter = "Handicap >" & GlobalVariables.DivNo And "Handicap <" & HighHandi
but got the following error;
System.InvalidCastException: 'Conversion from string "Handicap >16" to type 'Long' is not valid.'
I then tried
Dim HighHandi As String = GlobalVariables.DivNo2 + 1 MResultsDV.RowFilter = "Handicap >" & GlobalVariables.DivNo AndAlso "Handicap <" & HighHandi
but got this error; System.InvalidCastException: 'Conversion from string "Handicap >16" to type 'Boolean' is not valid.'
I also tried
MResultsDV.RowFilter = '"Handicap >" & GlobalVariables.DivNo' And '"Handicap <" & HighHandi'
which ran but did not work
Please, follow the links i've provided.
这篇关于如何使用两个过滤器过滤数据视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!