以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  添加了具有相同键的项  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=125323)

--  作者:刘林
--  发布时间:2018/9/26 12:14:00
--  添加了具有相同键的项
\'\'
Dim e As RequestEventArgs = args(0)
\'Dim sb As New StringBuilder
Dim wb As new weui
Dim lst As List(of DataRow) = DataTables("学生信息").sqlSelect("学校名称= \'内江市第五初级中学校\'")
wb.InsertHTML("<!DOCTYPE html>")
wb.InsertHTML("<html>")
wb.InsertHTML("<head>")
wb.InsertHTML("<meta charset=\'utf-8\'>")
wb.InsertHTML("<meta name=\'viewport\' c />")
wb.InsertHTML("<title></title>")
wb.InsertHTML("<script src=\'../mui/js/mui.js\'></script>")
wb.InsertHTML("<link href=\'../mui/css/mui.css\' rel=\'stylesheet\'/>")
wb.InsertHTML("<script Type=\'text/javascript\' charset=\'utf-8\'>mui.init();</script>")
wb.InsertHTML("</head>")
wb.InsertHTML("<body>")
wb.InsertHTML("<header class=\'mui-bar mui-bar-nav mui-bar-nav-bg\'>")
wb.InsertHTML("<a  id=\'icon-menu\' class=\'mui-action-back mui-icon mui-icon-left-nav mui-pull-left\'></a>")
wb.InsertHTML("<h1 class=\'mui-title\'>学生信息</h1>")
wb.InsertHTML("</header>")
wb.InsertHTML("<div class=\'mui-content\'>")
wb.InsertHTML("<br>")
wb.InsertHTML("<br>")
wb.InsertHTML("<br>")
Dim nms() As String = {"班级","学生姓名","身份证件号","学籍号","户籍地址","家庭住址","监护人姓名","联系电话","民族","政治面貌","综合素质","邮政编码","户口性质","出生日期","性别","状态","就读方式","是否建档立卡贫困户","健康状况","是否留守"}
Dim cps() As String ={"班级","学生姓名","身份证件号","学籍号","户籍地址","家庭住址","监护人姓名","联系电话","民族","政治面貌","综合素质","邮政编码","户口性质","出生日期","性别","状态","就读方式","是否建档立卡贫困户","健康状况","是否留守"}
wb.InsertHTML("<div style=\'width:100%; overflow-x:auto;\'>")
wb.InsertHTML("<Table border=\'1\'cellpadding=\'0\' align=\'center\'>")
wb.InsertHTML("<tr>")
For Each cp As String In cps
    wb.InsertHTML("<td style=\'font-size:20px;color:blue;white-space:nowrap;\' align=\'center\'>" & cp & "</td>")
Next
wb.InsertHTML("</tr>")
For r As Integer=0 To lst.Count-1
    wb.InsertHTML("<tr>")
    For Each nm As String In nms
        wb.InsertHTML("<td style=\'font-size:16px;white-space:nowrap;\' align =\'center\'>" & lst(r)(nm) & "</td>")
    Next
    wb.InsertHTML("</tr>")
Next
wb.InsertHTML("</Table></br></br></br>")
wb.InsertHTML("</div>")
e.WriteString(wb.Build)
\'e.Handled = True


NET Framework 版本:2.0.50727.8793
Foxtable 版本:2018.9.9.1
错误所在事件:自定义函数xsxx2
详细错误信息:
调用的目标发生了异常。
已添加了具有相同键的项。


请问老师这个哪里有错?没找出哪里不对呢

--  作者:有点甜
--  发布时间:2018/9/26 12:19:00
--  

加入msgbox,定位哪一句代码出错。

 

 


--  作者:刘林
--  发布时间:2018/9/26 12:22:00
--  
\'\'
Dim e As RequestEventArgs = args(0)
\'Dim sb As New StringBuilder
Dim wb As new weui
Dim lst As List(of DataRow) = DataTables("学生信息").sqlSelect("学校名称= \'内江市第五初级中学校\'")
wb.InsertHTML("<!DOCTYPE html>")
wb.InsertHTML("<html>")
wb.InsertHTML("<head>")
wb.InsertHTML("<meta charset=\'utf-8\'>")
wb.InsertHTML("<meta name=\'viewport\' c />")
wb.InsertHTML("<title></title>")
wb.InsertHTML("<script src=\'../mui/js/mui.js\'></script>")
wb.InsertHTML("<link href=\'../mui/css/mui.css\' rel=\'stylesheet\'/>")
wb.InsertHTML("<script Type=\'text/javascript\' charset=\'utf-8\'>mui.init();</script>")
wb.InsertHTML("</head>")
wb.InsertHTML("<body>")
wb.InsertHTML("<header class=\'mui-bar mui-bar-nav mui-bar-nav-bg\'>")
wb.InsertHTML("<a  id=\'icon-menu\' class=\'mui-action-back mui-icon mui-icon-left-nav mui-pull-left\'></a>")
wb.InsertHTML("<h1 class=\'mui-title\'>学生信息</h1>")
wb.InsertHTML("</header>")
wb.InsertHTML("<div class=\'mui-content\'>")
wb.InsertHTML("<br>")
wb.InsertHTML("<br>")
wb.InsertHTML("<br>")
messagebox.show("没问题")
Dim nms() As String = {"班级","学生姓名","身份证件号","学籍号","户籍地址","家庭住址","监护人姓名","联系电话","民族","政治面貌","综合素质","邮政编码","户口性质","出生日期","性别","状态","就读方式","是否建档立卡贫困户","健康状况","是否留守"}
Dim cps() As String = {"班级","学生姓名","身份证件号","学籍号","户籍地址","家庭住址","监护人姓名","联系电话","民族","政治面貌","综合素质","邮政编码","户口性质","出生日期","性别","状态","就读方式","是否建档立卡贫困户","健康状况","是否留守"}
messagebox.show("没问题1")
wb.InsertHTML("<div style=\'width:100%; overflow-x:auto;\'>")
wb.InsertHTML("<Table border=\'1\'cellpadding=\'0\' align=\'center\'>")
wb.InsertHTML("<tr>")
For Each cp As String In cps
    wb.InsertHTML("<td style=\'font-size:20px;color:blue;white-space:nowrap;\' align=\'center\'>" & cp & "</td>")
Next
wb.InsertHTML("</tr>")
messagebox.show("没问题2")
For r As Integer=0 To lst.Count-1
    wb.InsertHTML("<tr>")
    For Each nm As String In nms
        wb.InsertHTML("<td style=\'font-size:16px;white-space:nowrap;\' align =\'center\'>" & lst(r)(nm) & "</td>")
    Next
    wb.InsertHTML("</tr>")
Next
messagebox.show("没问题3")
wb.InsertHTML("</Table></br></br></br>")
wb.InsertHTML("</div>")
e.WriteString(wb.Build)
\'e.Handled = True



messagebox.show("没问题3")这个提示没出来,但这个写法我另一个页面也是这样没有问题


--  作者:有点甜
--  发布时间:2018/9/26 12:24:00
--  
循环里面加入msgbox,弹出信息,看看执行到哪里报错。
--  作者:刘林
--  发布时间:2018/9/26 12:51:00
--  
\'\'
Dim e As RequestEventArgs = args(0)
\'Dim sb As New StringBuilder
Dim wb As new weui
Dim lst As List(of DataRow) = DataTables("学生信息").sqlSelect("学校名称= \'内江市东兴区田东小学\'")
wb.InsertHTML("<!DOCTYPE html>")
wb.InsertHTML("<html>")
wb.InsertHTML("<head>")
wb.InsertHTML("<meta charset=\'utf-8\'>")
wb.InsertHTML("<meta name=\'viewport\' c />")
wb.InsertHTML("<title></title>")
wb.InsertHTML("<script src=\'../mui/js/mui.js\'></script>")
wb.InsertHTML("<link href=\'../mui/css/mui.css\' rel=\'stylesheet\'/>")
wb.InsertHTML("<script Type=\'text/javascript\' charset=\'utf-8\'>mui.init();</script>")
wb.InsertHTML("</head>")
wb.InsertHTML("<body>")
wb.InsertHTML("<header class=\'mui-bar mui-bar-nav mui-bar-nav-bg\'>")
wb.InsertHTML("<a  id=\'icon-menu\' class=\'mui-action-back mui-icon mui-icon-left-nav mui-pull-left\'></a>")
wb.InsertHTML("<h1 class=\'mui-title\'>学生信息</h1>")
wb.InsertHTML("</header>")
wb.InsertHTML("<div class=\'mui-content\'>")
wb.InsertHTML("<br>")
wb.InsertHTML("<br>")
wb.InsertHTML("<br>")
messagebox.show("没问题")
Dim nms() As String = {"班级","学生姓名","身份证件号","学籍号","户籍地址","家庭住址","监护人姓名","联系电话","民族","政治面貌","综合素质","邮政编码","户口性质","出生日期","性别","状态","就读方式","是否建档立卡贫困户","健康状况","是否留守"}
Dim cps() As String = {"班级","学生姓名","身份证件号","学籍号","户籍地址","家庭住址","监护人姓名","联系电话","民族","政治面貌","综合素质","邮政编码","户口性质","出生日期","性别","状态","就读方式","是否建档立卡贫困户","健康状况","是否留守"}
messagebox.show("没问题1")
wb.InsertHTML("<div style=\'width:100%; overflow-x:auto;\'>")
wb.InsertHTML("<Table border=\'1\'cellpadding=\'0\' align=\'center\'>")
wb.InsertHTML("<tr>")
For Each cp As String In cps
    wb.InsertHTML("<td style=\'font-size:20px;color:blue;white-space:nowrap;\' align=\'center\'>" & cp & "</td>")
Next
wb.InsertHTML("</tr>")
messagebox.show("没问题2")
For r As Integer=0 To lst.Count-1
    wb.InsertHTML("<tr>")
    For Each nm As String In nms
        wb.InsertHTML("<td style=\'font-size:16px;white-space:nowrap;\' align =\'center\'>" & lst(r)(nm) & "</td>")
    Next
    messagebox.show(Lst(r)("学生姓名") & "没问题3")
    wb.InsertHTML("</tr>")
Next
messagebox.show("没问题4")
wb.InsertHTML("</Table></br></br></br>")
wb.InsertHTML("</div>")
e.WriteString(wb.Build)
\'e.Handled = True

我测试了记录少一点的messagebox.show("没问题4")出来了,但页面为空白

--  作者:刘林
--  发布时间:2018/9/26 13:10:00
--  
Dim nms() As String = {"班级","学生姓名","身份证件号","学籍号","户籍地址","家庭住址","监护人姓名","联系电话","民族","政治面貌","综合素质","邮政编码","户口性质","出生日期","性别","状态","就读方式","是否建档立卡贫困户","健康状况","是否留守"}
Dim cps() As String = {"班级","学生姓名","身份证件号","学籍号","户籍地址","家庭住址","监护人姓名","联系电话","民族","政治面貌","综合素质","邮政编码","户口性质","出生日期","性别","状态","就读方式","是否建档立卡贫困户","健康状况","是否留守"}

我把列数减少成几列可以显示,但估计不应该是这个原因,因为之前做个十几个列的都没问题。又测了当列数很少,但行数多时也出问题,难道内容不能太多了吗?这怎么办,又不想做分页显示

--  作者:有点甜
--  发布时间:2018/9/26 14:34:00
--  

循环里面加入msgbox或者output.show,看执行到哪个r,哪个nm,哪个值lst(r)(nm) 的时候开始报错的。


--  作者:刘林
--  发布时间:2018/9/26 17:38:00
--  
测试了,不是哪个r哪个lst(r)(nm)出错,而是总的单元格多了就会出错,如当行少数几行,多少列都不出错,但再少的列,当行多了也出错,请老师测试一下,这该怎么办
--  作者:有点甜
--  发布时间:2018/9/26 17:40:00
--  
以下是引用刘林在2018/9/26 17:38:00的发言:
测试了,不是哪个r哪个lst(r)(nm)出错,而是总的单元格多了就会出错,如当行少数几行,多少列都不出错,但再少的列,当行多了也出错,请老师测试一下,这该怎么办

 

不可能,实例发上来测试。


--  作者:刘林
--  发布时间:2018/9/26 18:10:00
--  
老师,我反复做了,同样的行和列在电脑上可以打开,但在手机上显示空白,当电脑上增加行是也出问题,是不是用这个方式不能显示内容多了,请老师试一下