当前代码如下:
Dim cmd As New SQLCommand
cmd.C '记得设置数据源名称
cmd.CommandText = "Se lect [_Identify],[_SortKey],卷宗名称,材料类别,材料名称,材料附件,材料guid From {View_juanzongcailiao} where 案件id='2b8ff1fa-2ed5-4cfd-ad3c-748616441a13' "
Dim dt As DataTable = cmd.ExecuteReader
Dim drs As List(Of DataRow) = dt.Se lect("材料名称 is not null and 材料guid is not null", "_SortKey")
Output.Show(drs.Count)
Dim j As New JObject
Dim ja As New JArray
For Each dr As DataRow In drs
Dim jo As New JObject
jo("id") = dr("材料guid").ToString
jo("label") = dr("卷宗名称").ToString
' jo("parentId") = "0"
' jo("fujian") = dr("材料附件").ToString
' jo("children") = GetNavigation1(dt, dr)
If Not ja.Contains(jo) Then
ja.Add(jo)
End If
Next
Output.Show(ja.ToString)
生成josn出现重复,怎么修正呢? 想以材料guid为唯一值,一个值只出现一次!
28
[
{
"id": "be125946-3411-4114-b074-d75fd9c99f35",
"label": "333"
},
{
"id": "be125946-3411-4114-b074-d75fd9c99f35",
"label": "333"
},
{
"id": "799c52ae-abe5-41be-be17-71baea6dd1bf",
"label": "333"
},
{
"id": "799c52ae-abe5-41be-be17-71baea6dd1bf",
"label": "333"
},
{
"id": "5b488b48-fe55-4e1b-ba91-4c1c3e4f4d51",
"label": "333"
},
{
"id": "5b488b48-fe55-4e1b-ba91-4c1c3e4f4d51",
"label": "333"
},
[此贴子已经被作者于2023/11/9 15:41:20编辑过]