以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  项目编号代码出错  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=119096)

--  作者:ZJZK2018
--  发布时间:2018/5/17 15:21:00
--  项目编号代码出错
老师你好:
下面代码出错:
    Case "旁站类别"
        If dr.IsNull("旁站类别") Then
            dr("旁站编号") = Nothing
        Else
            Dim flag As Boolean = False
            Dim fdr1 As DataRow = DataTables("系统设置").Find("内容 = \'" & dr("旁站类别") & "\'")
            If fdr1 IsNot Nothing Then
                Dim lb As String = fdr1("值") & "-"
                Dim bhs As List(of String) = e.DataTable.GetValues("项目编号|旁站类别", "旁站编号 Like \'" & lb & "%\' And [_Identify] <> " & e.DataRow("_Identify"))
                For i As Integer = 1 To bhs.count
                    If bhs(i-1) <> lb & Format(i, "0000") Then
                        lb = lb & Format(i, "0000")
                        flag = True
                        Exit For
                    End If
                Next
                If bhs.count = 0 Then
                    lb = lb & "0001"
                ElseIf flag = False Then
                    lb = lb & Format(bhs.count+1, "0000")
                End If
                dr("旁站编号") = lb
            End If
        End If

错误提示:

.NET Framework 版本:2.0.50727.8762
Foxtable 版本:2018.3.9.1
错误所在事件:表,旁站记录, DataColChanged
详细错误信息:
调用的目标发生了异常。
无法将类型为“System.Collections.Generic.List`1[System.String[]]”的对象强制转换为类型“System.Collections.Generic.List`1[System.String]”。

[此贴子已经被作者于2018/7/3 15:49:46编辑过]

--  作者:有点甜
--  发布时间:2018/5/17 15:33:00
--  

 

Case "旁站类别"
    If dr.IsNull("旁站类别") Then
        dr("旁站编号") = Nothing
    Else
        Dim flag As Boolean = False
        Dim fdr1 As DataRow = DataTables("系统设置").Find("内容 = \'" & dr("旁站类别") & "\'")
        If fdr1 IsNot Nothing Then
            Dim lb As String = fdr1("值") & "-"
            Dim bhs As List(of String) = e.DataTable.GetValues("旁站编号", "旁站编号 Like \'" & lb & "%\' And [_Identify] <> " & e.DataRow("_Identify"))
            For i As Integer = 1 To bhs.count
                If bhs(i-1) <> lb & Format(i, "0000") Then
                    lb = lb & Format(i, "0000")
                    flag = True
                    Exit For
                End If
            Next
            If bhs.count = 0 Then
                lb = lb & "0001"
            ElseIf flag = False Then
                lb = lb & Format(bhs.count+1, "0000")
            End If
            dr("旁站编号") = lb
        End If
    End if
   

 


--  作者:有点甜
--  发布时间:2018/5/17 15:34:00
--  
如果达不到要求,请上传具体实例说明你要做什么。