以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 集合转数组时出错 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=122099) |
-- 作者:yancheng -- 发布时间:2018/7/18 22:03:00 -- 集合转数组时出错 Sel ect Case e.DataCol.Name Case "数量" Dim dr As DataRow = DataTables("发票库存").find(" 名称 = \'" & e.DataRow("名称") & "\' and 规格 = \'" & e.DataRow("规格") & "\' and 单位 = \'" & e.DataRow("单位") & "\' ") If dr IsNot Nothing Then \'Dim df As DataRow = DataTables("发票主表").Find(" AutoID =\'" & e.DataRow("MainID") & "\'") \'If df("业务类型") = "收进发票" Then Dim drs As List(Of DataRow) = DataTables("发票主表").Select(" 业务类型 = \'收进发票\' ") Dim Values As new List(of String ) For Each dr2 As DataRow In drs Values.Add(dr2("autoid")) Next msgbox(0) Dim strs() As String = Values.ToArray msgbox(1) Dim drs1 As List(Of DataRow) = DataTables("发票主表").Select(" 业务类型 = \'开出发票\' ") Dim Values1 As new List(of String) For Each dr1 As DataRow In drs1 Values1.Add(dr1("autoid")) Next Dim strs1() As String = Values1.ToArray dr("入库数量") = DataTables("发票内容明细表").SQLCompute("sum(数量)"," 名称 = \'" & e.DataRow("名称") & "\' and 规格 = \'" & e.DataRow("规格") & "\' and 单位 = \'" & e.DataRow("单位") & "\' and MainID in strs ") \'ElseIf df("业务类型") = "开出发票" Then dr("出库数量") = DataTables("发票内容明细表").SQLCompute("sum(数量)"," 名称 = \'" & e.DataRow("名称") & "\' and 规格 = \'" & e.DataRow("规格") & "\' and 单位 = \'" & e.DataRow("单位") & "\' and MainID in strs1 ") dr.save End If End Sele ct 提示说:strs 、 strs1附近有错误 |
-- 作者:有点甜 -- 发布时间:2018/7/18 22:18:00 -- 看看
Dim lst As new List(Of String) Dim str As String = String.Join("\',\'",lst.ToArray) |