Foxtable(狐表)用户栏目专家坐堂 → ‘想判断不等于formid的数据 就删除,结果数据全部删除了’


  共有4829人关注过本帖树形打印复制链接

主题:‘想判断不等于formid的数据 就删除,结果数据全部删除了’

帅哥哟,离线,有人找我吗?
cnsjroom
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:七尾狐 帖子:1571 积分:11238 威望:0 精华:0 注册:2021/1/17 17:06:00
‘想判断不等于formid的数据 就删除,结果数据全部删除了’  发帖心情 Post By:2022/11/1 15:34:00 [显示全部帖子]

‘想判断不等于formid的数据  就删除,结果数据全部删除了’

怎么修正呢?等于formid的值的数据不删除  反之就删除

 

当前代码如下:
Dim cmd As New SQ LCommand
cmd.Conn ectio nName = "web"
cmd.Comma ndText =  "sel ect * from {Navigation}"
Dim bt As DataTable = cmd.ExecuteReader()
Dim Products As List(Of String)
Products = bt.GetValues("formid")

For Each Product As String In Products
    For Each File As String In FileSys.GetFiles(ProjectPath & "MyWeb\pages\")
       
        If file.Contains(Product) Then   ‘想判断不等于formid的数据  就删除,结果数据全部删除了’
        Else
            If FileSys.FileExists(File) Then '如果指定的文件存在
                output.show(File)
                FileSys.DeleteFile(File,2,2) '则彻底删除之
            End If
        End If
    Next
Next

[此贴子已经被作者于2022/11/1 15:34:53编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
cnsjroom
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:七尾狐 帖子:1571 积分:11238 威望:0 精华:0 注册:2021/1/17 17:06:00
回复:(有点蓝)调换代码的顺序    F...  发帖心情 Post By:2022/11/1 17:46:00 [显示全部帖子]

Dim cmd As New S QLCommand
cmd.Conn ecti
cmd.Comm andText =  "sele ct * from {Navigation}"
Dim bt As DataTable = cm d.ExecuteReader()
Dim Products As List(Of String)
Products = bt.GetValues("formid")
For Each File As String In FileSys.GetFiles(ProjectPath & "MyWeb\pages\")
For Each Product As String In Products
        If file.Contains(Product) Then   '想判断不等于formid的数据  就删除,结果数据全部删除了'
        Else

            If FileSys.FileExists(File) Then '如果指定的文件存在
                output.show(File)
                FileSys.DeleteFile(File,2,2) '则彻底删除之
            End If

        End If
    Next
Next

 

老师调换顺序后  还是一样  全部干掉了 


 回到顶部