以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 这个函数写的有问题吗,表格不能正常加载! (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=158096) |
-- 作者:foxtablefanse -- 发布时间:2020/11/7 16:52:00 -- 这个函数写的有问题吗,表格不能正常加载! \'路单-合成筛选条件,输出结果. Dim e As RequestEventArgs = args(0) Dim wb As WeUI \'LuDanGetFilter函数需要输入的条件保存到Cookie中,而Coolie的保存和删除是通过WeUI完成的,所以在调用LuDanGetFilter的时候,需要将WeUI作为第二个参数传递过去. Dim flt As String \'Dim curname As String= e.Cookies("uname") \'临时保存当前用户,以免被清除. If e.GetValues.ContainsKey("isindex") OrElse e.GetValues.ContainsKey("unfilter") Then \'如果是取消筛选或从主页加载 flt="姓名= \'" & e.Cookies("uname") & "\' and datediff(month,[启用日期],getdate())=0" \' wb.ClearCookie() \'此两行清除除当前用户以外的所有Cookie \' wb.AppendCookie("uname",curname) \' msgbox(flt) ElseIf e.PostValues.Count > 0 msgBox(2) flt = Functions.Execute("LuDanGetFilter",e, wb) \'根据输入内容合成条件,注意WeUI也需要传递过去 \'Else \'flt = Functions.Execute("LuDanGetCookieFilter",e) \'根据Cookie合成条件 End If \'获取要显示的页码 Dim page As Integer = 0 \'默认page为0,显示第一页 Dim pageRows As Integer = 10 \'每页10行 If e.GetValues.ContainsKey("page") Then \'如果地址中有page参数 Integer.TryParse(e.GetValues("page"), page) \'提取page参数 End If Dim StartRow As Integer = page * pageRows + 1 \'此页第一行 Dim EndRow As Integer = (page + 1) * pageRows \'此页最后一行 \'提取此页数据 ......(略) ...... Dim dt As DataTable = cmd.ExecuteReader msgbox("1: " & cmd.Com mandText ) \'运行到这里都没有问题,数据源设置也没有问题,拼成的SQL在数据库上运行正常。 With wb.AddTable("","Table1") .PageNumber = page \'设置页码 .Primarykey = "_Identify" \'设置主键 .ActiveSheet = "menu" \'指定菜单 .CreateFromDataTable(dt) End With With wb.AddButtonGroup("","btg2", False) If page > 0 Then .Add("btnFirst", "第一页","","ldlist.htm?page=0") .Add("btnPrev", "上一页","","ldlist.htm?page=" & page - 1) Else .Add("btnFirst", "第一页","button").Kind = 1 .Add("btnPrev", "上一页","button").Kind = 1 End If If Endrow < count Then .Add("btnNext", "下一页","","ldlist.htm?page=" & page + 1) .Add("btnLast", "最末页","","ldlist.htm?page=" & pages - 1) Else .Add("btnNext", "下一页","button").Kind = 1 .Add("btnLast", "最末页","button").Kind = 1 End If End With With wb.AddActionSheet("","menu") \'设计菜单 If flt = "" Then .Add("mnuFilter", "数据筛选","ldfilter.htm") Else .Add("mnuUnFilter", "取消筛选","ldlist.htm?unfilter=true") End If .Add("mnuCancel","取消","",True) End With \'Dim sb As New StringBuilder \'sb.AppendLine("<meta name=\'viewport\' c>") \'sb.AppendLine(cmd.CommandText ) \'e.WriteString(sb.ToString) \' e.WriteString(wb.Build) [此贴子已经被作者于2020/11/7 16:52:26编辑过]
|
-- 作者:有点蓝 -- 发布时间:2020/11/7 16:57:00 -- 到服务端项目建一个窗口,放一个窗口表,然后测试返回的数据是否正常? Dim dt As DataTable = cmd.ExecuteReader tables("窗口1_table1").datasource = dt 如果也不正常,说sql执行本身就有问题 如果正常,把httprequest事件完整代码发上来看看。还有这个函数的名称
|