如何在TimeSpan值上过滤DataColumn? [英] How can I filter a DataColumn on a TimeSpan value?
本文介绍了如何在TimeSpan值上过滤DataColumn?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
DataView myDataView = new DataView(SomeDataTable);
myDataView.RowFilter + =Time> = 1; //不起作用
myDataView.RowFilter + =Time> =#00:00:01#; // does not work
myDataView.RowFilter + =Time<>; // does not work
myDataView.RowFilter + =Time<>; //不工作
解决方案
我发现了。
myDataView.RowFilter =Convert(Time,System.String)&'
Programming in C#.NET. I have a DataTable with a column named Time which is of type System.TimeSpan. When I display the DataTable in a DataGridView I want to filter out all the entries that don't have a time listed. I have tried the following but to no avail. Can you help?
DataView myDataView = new DataView(SomeDataTable);
myDataView.RowFilter += "Time >= 1"; // doesn't work
myDataView.RowFilter += "Time >= #00:00:01#"; // doesn't work
myDataView.RowFilter += "Time <> ''"; // doesn't work
myDataView.RowFilter += "Time <> ''"; // doesn't work
解决方案
I found it...
myDataView.RowFilter = "Convert(Time, System.String) <> ''";
这篇关于如何在TimeSpan值上过滤DataColumn?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文