以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  显示多个不同状态的行  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=23069)

--  作者:明丰
--  发布时间:2012/8/31 18:59:00
--  显示多个不同状态的行

Dim dt As DataTable = CurrentTable.DataTable
Dim d As String
For Each dr As DataRow In dt.DataRows
    If dr.RowState = DataRowState.Modified Then
        d = d & "[_Identify] = " & dr("_Identify") & " or "
    End If
Next
For Each dr As DataRow In dt.DataRows
    If dr.RowState = DataRowState.Added Then
        d = d & "[_Identify] = " & dr("_Identify") & " or "
    End If
Next
If d IsNot Nothing Then
    d = d.Trim(" ","o","r")
    CurrentTable.Filter = d
End If

 

上面的代码同时显示新增行和已经修改的行,但代码较长。


下面的代码只能显示一种状态的行,如果要同时显示新增行和已经修改的行,请问如何设置?

 

显示新增行:
CurrentTable.StateFilter = StateFilterEnum.Added

 

显示已经修改的行:
CurrentTable.StateFilter = StateFilterEnum.Modified


--  作者:jspta
--  发布时间:2012/8/31 20:57:00
--  

Dim dt As DataTable = CurrentTable.DataTable
Dim d As String
For Each dr As DataRow In dt.DataRows
    If dr.RowState = DataRowState.Modified Then
        d = d & "," &  dr("_Identify")
    ElseIf dr.RowState = DataRowState.Added Then
        d = d & "," &  dr("_Identify")
    End If
Next
If d <> "" Then
    d = d.Trim(",")
    CurrentTable.Filter = "[_Identify] in (" & d & ")"
End If

 

StateFilter是枚举型的,没有办法



--  作者:czy
--  发布时间:2012/8/31 21:31:00
--  
For Each dr As DataRow In CurrentTable.DataTable.DataRows
    If dr.RowState = DataRowState.Modified Then
        dr.BaseRow("System_Filter_Unique") = 1
    ElseIf dr.RowState = DataRowState.Added Then
        dr.BaseRow("System_Filter_Unique") = 1
    End If
Next
CurrentTable.Filter = "System_Filter_Unique = 1"

--  作者:明丰
--  发布时间:2012/8/31 22:10:00
--  
谢谢!
--  作者:jspta
--  发布时间:2012/8/31 23:12:00
--  
以下是引用czy在2012-8-31 21:31:00的发言:
For Each dr As DataRow In CurrentTable.DataTable.DataRows
    If dr.RowState = DataRowState.Modified Then
        dr.BaseRow("System_Filter_Unique") = 1
    ElseIf dr.RowState = DataRowState.Added Then
        dr.BaseRow("System_Filter_Unique") = 1
    End If
Next
CurrentTable.Filter = "System_Filter_Unique = 1"

请教baseRow怎么用?