以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  未按照时间区间加载  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=179963)

--  作者:tld
--  发布时间:2022/9/20 18:23:00
--  未按照时间区间加载
老师好。下面的代码,我希望按照时间区间加载数据。在外部数据表中,datatables(name)我设定加载50行。但是执行下面代码后实际运行结果还是50行,没有按照时间区间加载。请您指点。谢谢!
Dim dtb1 As DataTable = DataTables (name)

Dim name_rq As String = e.Form.Controls("Combo日期列").Value
 
Dim date1 As Date = e.Form.Controls("DateTimePicker1").Value
Dim date2 As Date = e.Form.Controls("DateTimePicker2").Value
Dim filter As String = name_rq & ">= \'" & date1 & "\' And " &  name_rq & " <= \'" & date2 & "\'"

Tables (e.Form.Name & "_table1").DataSource = dtb1
Tables (e.Form.Name & "_table1").DataTable.LoadFilter = filter 
Tables (e.Form.Name & "_table1").DataTable.Load

--  作者:有点蓝
--  发布时间:2022/9/20 20:13:00
--  
Dim name_rq As String = e.Form.Controls("Combo日期列").Value
 
Dim date1 As Date = e.Form.Controls("DateTimePicker1").Value
Dim date2 As Date = e.Form.Controls("DateTimePicker2").Value
Dim filter As String = name_rq & ">= \'" & date1 & "\' And " &  name_rq & " <= \'" & date2 & "\'"
Tables (e.Form.Name & "_table1").fill("select * from {" & name & "} where " & filter,"数据源名称",false)