老师 现在能够进行值的josn了 但是红色部分会循环四*四 也就是每条数据会有重复的十六条产生,有没有办法去重呢?
Dim cmd As New SQLCommand
cmd.Connecti '记得设置数据源名称
cmd.Com mandText = "Se lect * From {评查活动案件卷宗材料}"
Dim dt1 As DataTable = cmd.ExecuteReader
Dim ja1 As New JArray
Dim drs1 As List(Of DataRow) = dt1.Select("")
For Each dr1 As DataRow In drs1
Dim json As String = dr1("材料附件").ToString
Dim jsonObjects As JArray = JArray.Parse(json)
Dim firstJsonObject As JObject = jsonObjects(0)
Dim urlValue As String = firstJsonObject("url").tostring()
Dim Values() As String
Values = urlValue.split("/")
For Index As Integer = 0 To Values.Length - 1
output.show(Values.Length)
Output.Show(Values(0))
Output.Show(Values(1))
Output.Show(Values(2))
Output.Show(Values(3))
If Values(3) <> "" Then
If FileSys.DirectoryExists("D:\12+3\myfile\" & Values(2)) Then
If FileSys.FileExists("D: \ 12 + 3 \ myfile \ " & Values(2) & " \ " & Values(3)) Then
Else
If FileSys.DirectoryExists("C:\MyFolder1\" & dr1("活动id") & "\" & dr1("案件id") & "\" & Values(2)) Then '如果目录C:\MyFolder存在
If FileSys.FileExists("C:\MyFolder1\" & dr1("活动id") & "\" & dr1("案件id") & "\" & Values(2) & "\" & Values(3)) Then
Else
output.Show( Values(3) & "文件不存在或删除!")
FileSys.CopyFile("D:\12+3\myfile\" & Values(2) & "\" & Values(3), "C:\MyFolder1\" & dr1("活动id") & "\" & dr1("案件id") & "\" & Values(2) & "\" & Values(3), True)
End If
Else
FileSys.CreateDirectory("C:\MyFolder1\" & dr1("活动id") & "\" & dr1("案件id"))
If FileSys.FileExists("C:\MyFolder1\" & dr1("活动id") & "" & dr1("案件id") & "\" & Values(2) & "\" & Values(3)) Then
Else
output.Show( Values(3) & "文件不存在或删除!")
FileSys.CopyFile("D:\12+3\myfile\" & Values(2) & "\" & Values(3), "C:\MyFolder1\" & dr1("活动id") & "\" & dr1("案件id") & "\" & Values(2) & "\" & Values(3), True)
End If
End If
Dim j As New JObject
Dim ja As New JArray
Dim jo As New JObject
Dim ss As String = "C:\MyFolder1\" & dr1("活动id") & "\" & dr1("案件id") & "\" & Values(3)
SS = SS.Replace("\", "/")
jo("url") = ss
jo("name") = Values(3)
ja.Add(jo)
Output.show(ja.ToString)
End If
Else
End If
End If
Next
Next