如何使用数据表中的开始日期和结束日期过滤单个日期列 [英] how to filter a single date column with start date and end date in a datatable
本文介绍了如何使用数据表中的开始日期和结束日期过滤单个日期列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用数据表中的开始日期和结束日期过滤单个日期列?
优先使用dataview
how to filter a single date column with start date and end date in a datatable?
Preferentially using dataview
推荐答案
这是解决方案。试试这个
This is the solution. Try this
string filter = " (Date >= #" +
Convert.ToDateTime(txtStartDate.Text).ToString("MM/dd/yyyy") +
"# And Date <= #" +
Convert.ToDateTime(txtEndDate.Text).ToString("MM/dd/yyyy") +
"# ) ";
DataView dvFormula = dsFormula.Tables[0].DefaultView;
dvFormula.RowFilter = filter ;
这篇关于如何使用数据表中的开始日期和结束日期过滤单个日期列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文