Foxtable(狐表)用户栏目专家坐堂 → 条件筛选问题


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

主题:条件筛选问题

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2015/11/10 14:29:00 [显示全部帖子]

Dim SQL,s1 As String
SQL = "Select  *  Fr"  &  "om{表A} Where 数量 <=9"


Dim cmd As New SQLCommand
Dim dt As DataTable
Dim i As Integer =0


cmd.CommandText = SQL
dt = cmd.ExecuteReader()
Dim drs2 As List(of DataRow) = dt.Select("","物品,次序")


SQL =Nothing
s1 = " Union all S" & "elect 物品,次序,数量 Fr"  &  "om{表A} Where [_Identify] =  @ID"

Dim count As Integer = 1
For Each dr1 As DataRow In drs2
    If  i >0  AndAlso dr1("物品") = drs2(i-1)("物品") AndAlso dr1("次序") = drs2(i-1)("次序")+1 Then
        count += 1
        If count = 3 Then
            SQL+=s1.replace("@ID",drs2(i-2)("_Identify") )
            SQL+=s1.replace("@ID",drs2(i-1)("_Identify") )
            SQL+=s1.replace("@ID",dr1("_Identify") )
            count = 1
        End If
    End If
    i+=1
Next

 


If SQL IsNot Nothing Then
    SQL= SQL.SubString(11)
    Output.Show(SQL)
   
End If


 回到顶部