以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  数组  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=135184)

--  作者:qinjh18935180888
--  发布时间:2019/5/20 10:52:00
--  数组
Dim nmm() As String = {"BX","JK","WH","GZ"}
Dim nms1() As String = {"项目编号,报销类型,费用类型,费用金额,发生时间,报销事由","项目编号,用途,打卡人姓名,借款金额,备注","项目编号,费用类别,金额,项目描述,打卡人姓名,备注","员工姓名,代扣金额,应领金额,合计金额,备注"}
For i As Integer = 0 To nmm.Length - 1
        cmd.CommandText = "se lect * from 报销明细 where 申请编号  = \'" & e.GetValues("key") & "\'"
        dt1 = cmd.ExecuteReader
        Dim aa() As String = nms1(i).Split(",")
Next

With wb.AddTable("","detailTable")
    .CreateFromDataTable(dt1,False,"" ,"",nms1)
End With

提示 :.CreateFromDataTable(dt1,False,"" ,"",aa),这里出错,这什么原因。这和例子的代码没有什么区别呀。  Dim nms() As String  = "产品,客户,日期,数量".Split(",")

--  作者:有点甜
--  发布时间:2019/5/20 11:07:00
--  

 

所贴出的代码没有错。请贴出完整代码。

 

 


--  作者:qinjh18935180888
--  发布时间:2019/5/20 11:17:00
--  
Dim Filter,bj As String
Dim dt1 As DataTable
filter = "进度 = \'3B\' Or 进度 = \'4A\' "
bj = "4A"
Dim cmd As new SQLCommand
cmd.Cup date 费用申请表 set 进度 = \'" & bj & "\' where " & filter
cmd.ExecuteNonQuery
\'获取要显示的页
Dim page As Integer = 0 \'默认page为0,显示第一页
Dim pageRows As Integer = 1 \'每页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 \'此页最后一行
\'获取该页数据
cmd.CommandText = "Se lect Count(*) From {费用申请表} where " & filter
Dim Count As Integer = cmd.ExecuteScalar() \'获取总的行数
cmd.CommandText = "Se lect * From (Se lect Row_Number() Over(Order by 项目编号 desc) As [NO.],[_Identify],项目编号,申请金额,打卡人,申请日期,发票编号," & _
"申请编号 From 费用申请表 where " & filter & ") As a "
cmd.CommandText = cmd.CommandText  & "  Where  [NO.]>= " & StartRow & " And [NO.] <= " & EndRow
Dim dt As DataTable = cmd.ExecuteReader
Dim nmm() As String = {"BX","JK","WH","GZ"}
Dim nms1() As String = {"项目编号,报销类型,费用类型,费用金额,发生时间,报销事由","项目编号,用途,打卡人姓名,借款金额,备注","项目编号,费用类别,金额,项目描述,打卡人姓名,备注","员工姓名,代扣金额,应领金额,合计金额,备注"}
For i As Integer = 0 To nmm.Length - 1
    If e.getValues("key").contains(nmm(i)) Then
        cmd.CommandText = "se lect * from 报销明细 where 申请编号  = \'" & e.GetValues("key") & "\'"
        dt1 = cmd.ExecuteReader
        Dim aa() As String = nms1(i).Split(",")
    End If
Next
\'生成菜单
Dim wb As New WeUI
With wb.AddActionSheet("","menu") \'设计菜单
    .Add("mnudAdd", "查看明细").Attribute="" \'调用js函数
    .Add("mnuCancel","取消","",True)
End With

\'根据此页数据生成网页
wb.InsertHTML("<h3 align=\'center\' style=\'margin-top:5px\'>费用申请表</h3>")
With wb.AddTable("","Table1")
    .PageNumber = page \'设置页码
    .Primarykey = "申请编号" \'设置主键
    .ActiveSheet = "menu" \'设置菜单
    .CreateFromDataTable(dt)
End With
With wb.AddButtonGroup("","btg2", False) \'生成上一页和下一页按钮
    If page > 0 Then
        .Add("btnPrev", "上一页","","text.htm?page=" & page - 1)
    End If
    If Endrow < count Then
        \'.Add("btnNext", "下一页","","feiyongshenpi_liebiao.htm?page=" & page + 1)
        .Add("btnNext", "下一页","","text.htm?page=" & page + 1)
    End If
End With
wb.InsertHTML("<h3 align=\'center\' style=\'margin-top:5px\'>费用明细表</h3>")
With wb.AddTable("","detailTable")
    .CreateFromDataTable(dt1,False,"" ,"",aa)
End With
wb.AppendHTML("<script src=\'./lib/table.js\'></script>") \'引入脚本文件
e.WriteString(wb.Build)
[此贴子已经被作者于2019/5/20 11:22:45编辑过]

--  作者:有点甜
--  发布时间:2019/5/20 11:31:00
--  

删除这个代码

 

.CreateFromDataTable(dt1,False,"" ,"",aa)

 

或者改成

 

Dim nmm() As String = {"BX","JK","WH","GZ"}
Dim nms1() As String = {"项目编号,报销类型,费用类型,费用金额,发生时间,报销事由","项目编号,用途,打卡人姓名,借款金额,备注","项目编号,费用类别,金额,项目描述,打卡人姓名,备注","员工姓名,代扣金额,应领金额,合计金额,备注"}

Dim bb() As String
For i As Integer = 0 To nmm.Length - 1
    If e.getValues("key").contains(nmm(i)) Then
        cmd.CommandText = "se lect * from 报销明细 where 申请编号  = \'" & e.GetValues("key") & "\'"
        dt1 = cmd.ExecuteReader
        bb = nms1(i).Split("\',\'")
    End If
Next

 

.CreateFromDataTable(dt1,False,"" ,"", bb)