以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  SQLJoinTableBuilder 数据源问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=128848)

--  作者:pizzahe
--  发布时间:2018/12/16 18:02:00
--  SQLJoinTableBuilder 数据源问题
这个工具,从ACC数据源改成SQL数据源出错了,怎么解决

Dim jb As New SQLJoinTableBuilder("查询表1","YF_ChargeDetails")
jb.ConnectionName = dataName
jb.AddTable("YF_ChargeDetails","roomID","YF_room","ID")
jb.AddTable("YF_ChargeDetails","rentID","YF_rent","ID")

jb.AddCols("roomName as 房间名称" ,"roomType as 房间类型","custName as 客户名称","Tell as 电话","{YF_ChargeDetails}.addDate as 收费日期","Serial as 流水号","Startdate as 开始日期","Enddate as 结束日期","freeType as 费用类型","ChargeType as 收费类型","payment as 收款方式","freeName as 费用名称","price as 费用单价","shuliang as 数量周期","xiaoji as 费用小计","State as 费用状态","beizhu as 备注")



With Tables(e.Form.Name & "_Table1")

\' Dim nf As String = Forms("工作主窗口").Controls("TJ_年份").Value
Dim year As Integer = 2018 \'nf.Split(" ")(0)
Dim FirstDay As Date = New Date(year ,1,1) \'第一天
Dim LastDay As Date = New Date(year ,12 ,Date.DaysInMonth(year ,12 ))
jb.Filter = "YF_ChargeDetails.addDate >= #" & FirstDay & "# and YF_ChargeDetails.addDate <= #" & LastDay & "#"
MessageBox.Show(jb.BuildSql)
.Fill(jb.BuildSql,dataName ,True)
Functions.Execute("TableDrow",.Name)
.AutoSizeCols(10)
End With


--  作者:有点甜
--  发布时间:2018/12/16 18:17:00
--  

把这句删除,是否还报错?

 

jb.Filter = "YF_ChargeDetails.addDate >= #" & FirstDay & "# and YF_ChargeDetails.addDate <= #" & LastDay & "#"

 

 


--  作者:有点甜
--  发布时间:2018/12/16 20:08:00
--  

把生成的sql语句弄出来尝试,如

 

output.show(jb.BuildSql)

msgbox(jb.BuildSql)