你好,关于时间段是否可以用如下表达式?测试中好象订单时间(订单时间列属于time类型)这个筛选条件好象无效。主要希望可以实现对本次订单和前后的订单进行时间上的限制。前后时间间隔不超过60分钟。
Dim dr1 As DataRow
dr1 = DataTables("订单明细表").find( "订单日期 = '" & r("订单日期") & "' and 订单时间 <= '" & r("订单时间") & "'","订单时间 desc")
If dr1 IsNot Nothing Then
Dim d3 As Date = dr1("订单时间")
Dim d4 As Date = r("订单时间")
Dim t1 As TimeSpan = d4-d3
If dr1("交通地址_城市") = r("交通地址_城市") And dr1("交通地址_地铁站") = r("交通地址_地铁站") Then
If dr1("价格收款_单位") = "1C" Or dr1("价格收款_单位") = "1H" Or dr1("价格收款_单位") = "1H1C" Then
If t1.TotalMinutes < 60 Then
Dim Result1 As DialogResult
Result1 = MessageBox.Show("订单时间之前有其它订单,时间间隔不足60分钟,请问是否需要返回修改?","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Question)
If Result1 = DialogResult.Yes Then
Return
Else
r.Reject()
e.Form.close()
End If
End If
End If
End If
End If