以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  当前表存在关联,不允许有此方法加载关联  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=159975)

--  作者:hitzfeld
--  发布时间:2021/1/16 0:15:00
--  当前表存在关联,不允许有此方法加载关联
老师好,我碰到一个问题:A表与B表存在关联关系,A表为主表,在加载外部表的时候,我限制了只加载30天内的记录(datatable只有30天记录),但是我需要设置一个检索30天之前的记录的控件,然后我打算用SQL的FILL方法来加载数据库中的记录,设置了下面的代码:
Dim stardate As Date \'WinForm.DateTimePicker
stardate = e.Form.Controls("starDate").value   
Dim Enddate As Date \'WinForm.DateTimePicker
Enddate = e.Form.Controls("enddate").value
DataTables("A表").Fill("Se/ect * From {A表} where 下单日期 >=  \'" & starDate & "\' And 下单日期 <= \'" & enddate & "\' " ,"数据源名称", False)

然后运行,报“当前表存在关联,不允许有此方法加载关联”错误
我的问题是,要怎么写才能正确的加载数据库中30天之前的指定日期区间的记录(不用FILL方法也可以)?谢谢老师!



--  作者:有点蓝
--  发布时间:2021/1/16 9:38:00
--  

DataTables("A表").loadfilter ="下单日期 >=  \'" & starDate & "\' And 下单日期 <= \'" & enddate & "\' "
DataTables("A表").load