记录仅基于日期过滤器而不是时间
问题描述:
我只想要特定日期的记录。不要在条件标准中给出时间。
请指导...
Dim fndRows()As DataRow
fndRows = DataSet1.TransactionTestMaster.Select(" trandate = '15 / 02/2014'")
TextBox4.Text = fndRows.Length
3记录在TransactionTestMaster表中
TranDate(列名)
1)2014-02-15 16:51:00
2)2014-02-15 17:45:00
3)2014-04 -16 17:48:00
请指导....
I want records of particular date only. Not to give time in condition criteria.
Please guide...
Dim fndRows() As DataRow
fndRows = DataSet1.TransactionTestMaster.Select("trandate='15/02/2014'")
TextBox4.Text = fndRows.Length
3 Records are in TransactionTestMaster table
TranDate ( Column Name)
1) 2014-02-15 16:51:00
2) 2014-02-15 17:45:00
3) 2014-04-16 17:48:00
Please guide....
答
不保证它 - 因为我不知道你的TransactionTestMaster.Select方法是如何工作的 - 但是试试这个:
Don't guarantee it - because I have no idea how your TransactionTestMaster.Select method works - but try this:
fndRows = DataSet1.TransactionTestMaster.Select("DATEDIFF(d, '2014-02-15', trandate)=0")
我得到了解决方案...
I got the solution...
Dim fndRows() As DataRow
Dim dt1, dt2 As Date
dt1 = DateTran.Value.AddDays(-1)
dt2 = DateTran.Value.AddDays(1)
fndRows = DataSet1.TransactionTestMaster.Select("trandate >' " & dt1 & "' and trandate <'" & dt2 & "'")
TxtDaySrNo.Text = fndRows.Length + 1
这个有效。
This is working.
它无法正常工作。请做到需要或告诉别人......
It is not working. Please do needful or tell another way...