如何使用“日期大于"选择一天的数据?询问 [英] how to select data of one day using "date greate than" query
问题描述
< b>我正在使用列表视图来查看两个选定日期之间的数据,我有两种方法:
1.从mytable中选择*,其中mydate在""+ fromdate +"和""+ todate +"''之间;
2.从mytable中选择*,其中mydate& gt ==""+ fromdate +"''和mydate& lt ==" + todate +''";
但是问题是如果我选择与fromdate和todate相同的日期,其中表中存在未显示的记录!
任何帮助都请以简单的方式
谢谢
</b>
<b>Hi I am using a list view to view the data between two selected dates i have two ways:
1. "select * from mytable where mydate between ''" + fromdate + "'' and ''" + todate + "''";
2. "select * from mytable where mydate>= ''" + fromdate + "'' and mydate<= ''" + todate + "''";
but the problem is if i select the same date as fromdate and todate in which there exist records in table that does not show!
Any help please in simple way
thanks
</b>
推荐答案
您需要正确地转换日期并丢失时间部分.
尝试fromdate.ToString("yyyy-MM-dd")
和todate.ToString("yyyy-MM-dd")
祝你好运!
You need to convert the date correctly and lose the time part.
Tryfromdate.ToString("yyyy-MM-dd")
andtodate.ToString("yyyy-MM-dd")
good luck!
这篇关于如何使用“日期大于"选择一天的数据?询问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!