- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有两个要排序的 DataView
,在 dgtest1 中,我尝试对包含 Typeid != 25
的数据进行排序,在 dgtest2 中我试图只显示 Typeid == 25
处的数据。
当我单步执行代码时,我在说
时抛出错误"Cannot interpret token '!' at position 6".
谁能告诉我如何正确使用字符串行过滤器?
参数是(Data Table表,string RowFilter,string Sort,DataViewRowState)
dgtest1.ItemsSource = new DataView(dttest1, "Typeid!= 25", "", DataViewRowState.CurrentRows);
dgtest2.ItemsSource = new DataView(dttest1, "Typeid == 25", "", DataViewRowState.CurrentRows);
最佳答案
在第一个 Dataview 构造函数中用于 RowFilter 表达式的正确语法是
dgtest1.ItemsSource = new DataView(dttest1, "Typeid <> 25", "", DataViewRowState.CurrentRows);
^^
在第二个你需要使用
dgtest2.ItemsSource = new DataView(dttest1, "Typeid = 25", "", DataViewRowState.CurrentRows);
用于 DataView 构造函数中 RowFilter 参数的语法与用于属性 Expression 的语法相同DataColumn 的,它不像 C# 的相等运算符
编辑 根据您在下方的评论。如果 Typeid 是文本数据类型的数据库字段,那么您需要将 RowFilter 中使用的值括在单引号之间
dgtest1.ItemsSource = new DataView(dttest1, "Typeid <> '25'", "", DataViewRowState.CurrentRows);
dgtest2.ItemsSource = new DataView(dttest1, "Typeid = '25'", "", DataViewRowState.CurrentRows);
不过这看起来有点奇怪。如果 Typeid 字段包含数字,则应将其定义为数字数据类型。
关于c# - DataView 行过滤,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18600104/
这是我的 Dataview.List 这是我的 Dataview.Dataview 我想显示我的 Dataview.dataview 中的元素,就像我的 Dataview.List 中的元素一样。我只
我想通过过滤现有的 DataView 创建一个新的 DataView,但是我遇到了麻烦,因为 DataView 没有 .AsEnumerable() 方法并且没有实现 IEnumerable{Data
我想用如下状态和功能扩展 DataView: export class MyDataView extends DataView { public position: number; p
我正在使用 dataview 并使用它的 skip 和 take 方法,这将占用 5 行并根据页码和页面大小跳过一些行。 //creating a dataview object and assign
我正在为我的图片库使用 ExtJS DataView。这是我的项目工具提示方式。它在 tpl 中。 new Ext.XTemplate( '', '',
我无法在不转换的情况下查询 DataView。 IsPresent 方法中的两行代码取自 "LINQ - Specified cast is not valid with dataview use "
在我的应用程序中,我使用数据 View 在动态传递过滤器选项的地方应用过滤器。如果有 2 个过滤器参数,则数据 View 应针对参数 1 进行过滤,然后按参数 2 进行过滤。我正在使用一种在 for
我在我的页面上显示来自 DataTable 的信息,并想添加一些排序功能,这比直接的列排序要稍微好一点。因此,我一直在尝试将 LinkButtons 放在我的 GridView 的 HeaderI
我有两个要排序的 DataView,在 dgtest1 中,我尝试对包含 Typeid != 25 的数据进行排序,在 dgtest2 中我试图只显示 Typeid == 25 处的数据。 当我单步执
DataView 对象没有像 DataTable 那样的 Rows 属性。 如何循环遍历 DataView 的行? 最佳答案 DataView 对象本身用于循环遍历 DataView 行。 DataV
我正在尝试关注 http://mleibman.github.com/SlickGrid/examples/example4-model.html本教程。我下载了所有必需的 .js 文件(core.j
如何在顶部而不是默认在底部添加新行,在 slickgrid dataview impelmentation 中也很感激有人提供删除行的示例。 最佳答案 这是一个示例函数,可以与示例 1-simple.
我有一个数据表。我想按列名“城市”对其默认 View 进行排序。我希望排序不区分大小写。 这是我的代码: DataTable dt = GetDataFromSource(); dt.DefaultV
我有一个包含一列(“利润”)的数据表。我想要的是获取此表中所有值的总和。我试图通过以下方式做到这一点...... DataTable dsTemp = new DataTable(); dsTemp.
我在 DataView.Sort 上遇到性能瓶颈。代码如下。 /// /// Filters the data table and returns a new data table
我正在尝试确定 DataView 是否不包含数据。 lsSql = "Select col1, col2 from table where tableId = " + Id; DataView l
我有一个 DataTable包含一些行。复制到 DataView .现在我有 List 形式的 ID .其中包含从 GridView 中选择的项目.现在我想过滤这个 DataView使用 AND 作为
我有一个包含一些列的 gridview,我需要按日期列对 gridview 进行排序。但我无法正确排序。这是我使用的代码: dt.DefaultView.Sort = "Meldingsdatum a
我想将数据 View rowfilter 值转换为数据表。我有一个有值(value)的数据集。现在我正在使用数据 View 过滤值。现在我想将数据 View 过滤器值转换为数据表。请帮我复制它....
我有一个数据 View 。 dataview 的来源是来自 sql server 的 view。Dataview 已排序。像这样: dv_building.Sort = "bld_number" 此
我是一名优秀的程序员,十分优秀!