以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- MYSQL起止日期失效 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=189599) |
-- 作者:lin98 -- 发布时间:2023/12/11 12:58:00 -- MYSQL起止日期失效 MYSQL源,需求,按窗口的起止日期将表A和表B的合并后加载。 执行下面的代码,没有报错,也没有反应? Dim StartDate As Date = New Date(Date.today.Year, Date.today.Month, 1) Dim EndDate As Date = New Date(Date.today.Year, Date.today.Month, Date.DaysInMonth(Date.today.Year, Date.today.Month)) Dim db = HySq-l.DataBaseFactory.CreateDatabase("my") \' Dim Sq-l2 = "Selec-t a.单号,a.产品编号, a.品名, a.规格型号, a.单位, a.数量,b.供方, b.日期 From 表A as a Inner Join 表B as b On (a.单号 = b.单号) " & _ "where b.日期 >= \'" & StartDate & "\' And b.日期 <= \'" & EndDate & "\' " Dim dt2 As system.data.DataTable = db.ExecuteDataSet(Sq-l2).Tables(0) Dim t2 As Table = e.Form.Controls("Table1").Table t2.datasource = dt2.Copy t2.AllowEdit = False
[此贴子已经被作者于2023/12/11 16:03:21编辑过]
|
-- 作者:有点蓝 -- 发布时间:2023/12/11 13:33:00 -- 把生成的sql放到数据库里执行,看看有没有问题 |
-- 作者:lin98 -- 发布时间:2023/12/11 16:05:00 -- Dim StartDate As Date = New Date(Date.today.Year, Date.today.Month, 1) Dim EndDate As Date = New Date(Date.today.Year, Date.today.Month, Date.DaysInMonth(Date.today.Year, Date.today.Month)) "where b.日期 >= \'" & StartDate & "\' And b.日期 <= \'" & EndDate & "\' " 这个条件有问题,单独执行蓝代码没有问题,如何解决?
|
-- 作者:有点蓝 -- 发布时间:2023/12/11 16:18:00 -- 到命令窗口执行下面代码 Dim Sq-l2 = "Selec-t a.单号,a.产品编号, a.品名, a.规格型号, a.单位, a.数量,b.供方, b.日期 From 表A as a Inner Join 表B as b On (a.单号 = b.单号) " & _ "where b.日期 >= \'" & StartDate & "\' And b.日期 <= \'" & EndDate & "\' " output.show(Sq-l2 ) 把命令窗口显示的结果里合并的包含条件的sql放到数据库里执行看看有没有问题
|
-- 作者:lin98 -- 发布时间:2023/12/11 16:45:00 -- 按键单击执行上面代码,窗口上的目录树如何实现同步更新? |
-- 作者:有点蓝 -- 发布时间:2023/12/11 16:54:00 -- 原来的目录树是怎么生成的?把其代码复制一份放到上面代码之后,再执行一次 |