以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 有条件分页加载代码出错 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=134217) |
-- 作者:ZJZK2018 -- 发布时间:2019/4/30 9:46:00 -- 有条件分页加载代码出错 老师:我想根据操作员的归属部门进行数据加载,下面经色代码出错? 2、是不是SQL中不能用这种表达合成式来处理? \'========按归属部门进行数据加载========== Dim fyjzfit As String Dim fdr As DataRow = DataTables("Users").Find("Name = \'" & User.Name & "\'") If User.Type = UserTypeEnum.User Then If fdr IsNot Nothing Then If fdr("归属部门").Contains("总公司") Then fyjzfit = "[_Identify] Is Not Null" Else fyjzfit = "归属部门 = \'" & fdr("归属部门") & "\'" End If End If Else fyjzfit = "[_Identify] Is Not Null" End If \'生成目录树 Dim cmd As New SQLCommand Dim dt As DataTable cmd.ConnectionName = V cmd.CommandText = "Select DISTINCT 招标审核,咨询类型,归属部门,项目名称,业务性质,投标地区,评标方式,报价方式,项目状态,工程类别,开标日期 Fro m {招标信息} Where fyjzfit" dt = cmd.ExecuteReader() \'加载第一页数据 With DataTables("招标信息") .LoadFilter = fyjzfit \'清除加载条件 .LoadPage = 0 \'加载第一页 .LoadTop = 12 \'每页5行 .Load() e.Form.Controls("Page").Value = 1 & "/" & .TotalPages End With
|
-- 作者:有点甜 -- 发布时间:2019/4/30 9:58:00 -- 改成比如
cmd.CommandText = "Select DISTINCT 招标审核,咨询类型,归属部门,项目名称,业务性质,投标地区,评标方式,报价方式,项目状态,工程类别,开标日期 Fro m {招标信息} Where " & fyjzfit |
-- 作者:ZJZK2018 -- 发布时间:2019/4/30 10:04:00 -- 改成:cmd.CommandText = "Select DISTINCT 招标审核,咨询类型,归属部门,项目名称,业务性质,投标地区,评标方式,报价方式,项目状态,工程类别,开标日期 Fro m {招标信息} Where & fyjzfit" .NET Framework 版本:2.0.50727.8800 Foxtable 版本:2019.4.12.1 错误所在事件: 详细错误信息: \'&\' 附近有语法错误。 |
-- 作者:有点甜 -- 发布时间:2019/4/30 10:22:00 -- 请照抄啊
cmd.CommandText = "Select DISTINCT 招标审核,咨询类型,归属部门,项目名称,业务性质,投标地区,评标方式,报价方式,项目状态,工程类别,开标日期 From {招标信息} Where " & fyjzfit |
-- 作者:ZJZK2018 -- 发布时间:2019/5/1 0:21:00 -- 为什么下面红色代码按招标日期排序不起作用,如何处理? \'========按归属部门进行数据加载========== Dim fyjzfit As String \'分页加载 Dim fdr As DataRow = DataTables("Users").Find("Name = \'" & User.Name & "\'") If User.Type = UserTypeEnum.User Then If fdr IsNot Nothing Then If fdr("归属部门").Contains("总公司") Then fyjzfit = "[_Identify] Is Not Null" Else fyjzfit = "归属部门 = \'" & fdr("归属部门") & "\'" End If End If Else fyjzfit = "[_Identify] Is Not Null" End If \'生成从后台提取数据生成一个临时的DataTable Dim cmd As New SQLCommand Dim dt As DataTable cmd.C cmd.CommandText = "Select DISTINCT 招标审核,咨询类型,归属部门,项目名称,业务性质,投标地区,评标方式,报价方式,项目状态,工程类别,开标日期,系统编号 Fro m {招标信息} Where " & fyjzfit dt = cmd.ExecuteReader() Vars("zbxxdt") = dt \'加载第一页数据 With DataTables("招标信息") .LoadFilter = "" \'清除加载条件 .LoadPage = 0 \'加载第一页 .LoadTop = 15 \'每页5行 .LoadOrder = "开标日期 Desc" \'.LoadReverse = True .Load() e.Form.Controls("Page").Value = 1 & "/" & .TotalPages End With |
-- 作者:有点甜 -- 发布时间:2019/5/4 11:03:00 --
用LoadOver设置的分页,只能根据 _Identify 列排序,如果需要根据日期列排序,需要换一种方式,如
http://www.foxtable.com/webhelp/scr/2721.htm
|
-- 作者:ZJZK2018 -- 发布时间:2019/5/10 9:48:00 -- 筛选树红色代码部分如何调整?? 1、窗口AfterLoad \'========按归属部门进行数据加载========== Dim fyjzfit As String \'分页加载 Dim fdr As DataRow = DataTables("Users").Find("Name =
\'" & User.Name & "\'") If User.Type = UserTypeEnum.User Then If fdr IsNot Nothing Then If fdr("归属部门").Contains("总公司") Then fyjzfit = "[_Identify] Is
Not Null" Else fyjzfit = "归属部门 = \'" & fdr("归属部门") & "\'" End If End If Else fyjzfit = "[_Identify] Is Not Null" End If
\'生成从后台提取数据生成一个临时的DataTable Dim cmd As New SQLCommand Dim dt As DataTable cmd.C cmd.CommandText = "Select DISTINCT 招标审核,咨询类型,归属部门,项目名称,业务性质,投标地区,评标方式,报价方式,项目状态,工程类别,开标日期,系统编号 Fro m {招标信息} Where " & fyjzfit & " ORDER BY 开标日期 DESC" dt = cmd.ExecuteReader() Vars("zbxxdt") = dt
\'\'\'设置目录树 Dim trv As WinForm.TreeView = e.Form.Controls("Trv_sxs") trv.BuildTree(dt,"归属部门|咨询类型|投标地区") \' ,"","招标审核 DESC") \',"","开标日期 DESC") trv.Nodes.Insert("显示所有项目",0) trv.Nodes(1).Expand() 2、自定义函数LoadData_fy
\'========按归属部门进行数据加载========== Dim fy As String = Args(0) Dim fyjzfit As String \' =
"1=2" \'分页加载 Dim fdr As DataRow = DataTables("Users").Find("Name =
\'" & User.Name & "\'") If User.Type = UserTypeEnum.User Then If fdr IsNot Nothing Then If fdr("归属部门").Contains("总公司") Then fyjzfit = "[_Identify] Is
Not Null" Else fyjzfit = "归属部门 = \'" & fdr("归属部门") & "\'" End If End If Else fyjzfit = "[_Identify] Is Not Null" End If fyjzfit = fyjzfit & fy
Dim r1 As Integer = (Page - 1) * 20 + 1 Dim r2 As Integer = Page * 20 Dim sql As String Dim str As String = "" For Each dc As DataCol In DataTables("招标信息").DataCols str &= dc.name.Tostring & "," Next sql = "Select " & str.trim(",") & " Fro m
(Select Row_Number() Over(Order by 开标日期) As RowNum, * fro m 招标信息 where " & fyjzfit & ") As a " sql = sql & " Where RowNum >= " & r1 & " And
RowNum <= " & r2
DataTables("招标信息").SQLLoad(sql) [此贴子已经被作者于2019/5/10 10:30:16编辑过]
|
-- 作者:ZJZK2018 -- 发布时间:2019/5/10 10:00:00 -- Dim s As String = e.Form.Controls("Chebox_sxs").Text Dim tb1 As Table = Tables(e.Form.Name & "_Table1") Dim dt As DataTable = Vars("zbxxdt") Dim Colstr() As String Dim qts As String() = {"\'","#",""} Dim trv As WinForm.TreeView = e.Sender Dim flt As String = "" Dim nd As WinForm.TreeNode Dim pd As WinForm.TreeNode Dim notchecked As Integer = 0 Colstr = s.split("|") If e.Node.Name = "显示所有项目" Then If e.Node.Checked = True Then For Each nd In trv.AllNodes If nd.Name <> "显示所有项目"
Then nd.Checked = False End If Next tb1.Filter = "" Else For Each nd In trv.AllNodes nd.Checked = False ... If flt
> "" Then flt
= flt & " Or (" & val & ")" Else flt
= val End If
notchecked + = 1 End If Next
Dim fy As String = flt Page = 1 Functions.Execute("LoadData_fy",fy)
[此贴子已经被作者于2019/5/10 10:01:26编辑过]
|
-- 作者:有点甜 -- 发布时间:2019/5/10 10:07:00 --
代码不需要修改啊,现在执行报什么错?出现什么问题?
|
-- 作者:有点甜 -- 发布时间:2019/5/10 10:08:00 --
建议你把 fy 变量也和 page 一样,设置成public的,不然你换页的时候,获取不到条件fy。
|