Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
Dim cm As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim dt As table = tables("报表_Table3")
If cm.value = "" then
MessageBox.Show("请选择帐号!","提示")
Return
end if
dim Filter as string = "收付日期 >= #" & Vars("起始日期") & "# and 收付日期 <= #" & Vars("结束日期") & "# and 收付帐号 = '" & cm.value & "'"
dt.Fill("Select 业务号,收付日期,收付,收付公司,摘要,币制,实际收付金额,收付帐号 From {销帐录入} where filter","myacc",true)
如上的FILTER设置后为何窗口中的Table崩溃,打了个在XX
Dim cm As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim dt As table = tables("报表_Table3")
If cm.value = "" then
MessageBox.Show("请选择帐号!","提示")
Return
end if
dt.Fill("Select 收付日期,收付,收付公司,摘要,币制,实际收付金额 From {销帐录入} where 收付日期 >= #" & Vars("起始日期") & "# and 收付日期 <= #" & Vars("结束日期") & "# and 收付帐号 = '" & cm.value & "'","myacc",true)
Dim cmd As New SQLCommand
cmd.C
cmd.CommandText = "SELECT * From {办公开支}"
dim tb as datatable = cmd.ExecuteReader()
dim f As New Filler
f.SourceTable = tb
f.SourceCols = "日期,收支,类别,摘要,币种,金额"
f.DataTable = datatables("报表_Table3")
f.DataCols = "收付日期,收付,收付公司,摘要,币制,实际收付金额 "
f.Distinct = False
f.Filter = "[日期] >= #" & Vars("起始日期") & "# and [日期] <= #" & Vars("结束日期") & "# and 收支帐号 = '" & cm.value & "'"
f.Fill() '填充数据
"Select [_Identify],业务号,收付日期,收付,收付公司,摘要,币制,实际收付金额,收付帐号 From {销帐录入} where" & filter |
需要特别注意的是,如果只想取部分列生成SQLTable,那么必须包括主键列在内
呵呵,外部数据源也必须加载主键列的啊~ 还有 where & filter 学习了
SQLQuery型Table
SQlQuery的Table和SQLTable型的一样,利用Select语句从后台提取数据生成Table,不同的是SQLQuery的Select语句可以从多个表中取数据,但是SQLQuery生成的Table是不能编辑的。
哪位老师帮我将下面的代码利用SELECT语句整合一下,搞了一上午总是报错!
万分感谢!
Dim cm As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim dt As table = tables("报表_Table3")
If cm.value = "" then
MessageBox.Show("请选择帐号!","提示")
Return
end if
dt.Fill("Select 收付日期,收付,收付公司,摘要,币制,实际收付金额 From {销帐录入} where 收付日期 >= #" & Vars("起始日期") & "# and 收付日期 <= #" & Vars("结束日期") & "# and 收付帐号 = '" & cm.value & "'","myacc",true)
Dim cmd As New SQLCommand
cmd.C
cmd.CommandText = "SELECT * From {办公开支}"
dim tb as datatable = cmd.ExecuteReader()
dim f As New Filler
f.SourceTable = tb
f.SourceCols = "日期,收支,类别,摘要,币种,金额"
f.DataTable = datatables("报表_Table3")
f.DataCols = "收付日期,收付,收付公司,摘要,币制,实际收付金额 "
f.Distinct = False
f.Filter = "[日期] >= #" & Vars("起始日期") & "# and [日期] <= #" & Vars("结束日期") & "# and 收支帐号 = '" & cm.value & "'"
f.Fill() '填充数据
Dim cm As WinForm.ComboBox = e.Form.Controls("ComboBox1")
If cm.value = "" then
MessageBox.Show("请选择帐号!","提示")
Return
end if
Dim dtb As New DataTableBuilder("统计")
dtb.AddDef("日期", GetType(Date))
dtb.AddDef("收支", GetType(String),32)
dtb.AddDef("类别", GetType(String),32)
dtb.AddDef("摘要", GetType(String),32)
dtb.AddDef("币种", GetType(String),32)
dtb.AddDef("金额", GetType(Double))
dtb.AddDef("收支帐号",GetType(String),32)
dtb.AddDef("工作号",GetType(String), 100)
dtb.AddDef("往来",GetType(String), 32)
dtb.Build()
DataTables("统计").DataRows.Clear() '清除原有数据
Dim cmd As New SQLCommand
cmd.C
cmd.CommandText = "SELECT * From {销帐录入}"
dim tb as datatable = cmd.ExecuteReader()
dim f As New Filler
f.SourceTable = tb '指定数据来源
f.SourceCols = "收付日期,收付,收付公司,摘要,币制,实际收付金额,收付帐号,业务号" '指定数据来源列
f.DataTable = DataTables("统计") '指定数据接收表
f.DataCols = "日期,收支,类别,摘要,币种,金额,收支帐号,工作号" '指定数据接收列
f.Distinct = False
f.Filter = "[收付日期] >= #" & Vars("起始日期") & "# and [收付日期] <= #" & Vars("结束日期") & "# and 收付帐号 = '" & cm.value & "'"
f.Fill() '填充数据
cmd.CommandText = "SELECT * From {办公开支}"
dim tb1 as datatable = cmd.ExecuteReader()
dim f1 As New Filler
f1.SourceTable = tb1 '指定数据来源
f1.SourceCols = "日期,收支,类别,摘要,币种,金额,收支帐号,往来" '指定数据来源列
f1.DataTable = DataTables("统计") '指定数据接收表
f1.DataCols = "日期,收支,类别,摘要,币种,金额,收支帐号,往来" '指定数据接收列
f1.Distinct = False
f1.Filter = "[日期] >= #" & Vars("起始日期") & "# and [日期] <= #" & Vars("结束日期") & "# and 收支帐号 = '" & cm.value & "'"
f1.Fill() '填充数据
Tables("报表_Table3").DataSource = DataTables("统计")