Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Dataview RowFilter efficiency problem

Dataview RowFilter efficiency problem

Scheduled Pinned Locked Moved .NET (Core and Framework)
helpquestioncode-review
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    eatwork
    wrote on last edited by
    #1

    Hello all I was wondering if anyone out there knows of a way to filter out rows based on a condition that is more efficient than the dataview.rowfilter? Public Sub filterDataSource(ByVal filter As String) Dim tempSelectedValue As Object If IsNothing(Me.SelectedValue) = True Then tempSelectedValue = "-1" Else tempSelectedValue = Me.SelectedValue End If Me.mDataViewCombo.RowFilter = filter Try Me.SelectedValue = tempSelectedValue Catch ex As Exception End Try End Sub The "Me.mDataViewCombo.RowFilter = filter" takes about 2 seconds to complete when there are about 700 rows and I was wondering if there was any other way to improve upon that. I have tried to "Me.mDataViewCombo.table.select(filter)", but this method does not seem to filter anything at all. Thank you. eatwork

    R D 2 Replies Last reply
    0
    • E eatwork

      Hello all I was wondering if anyone out there knows of a way to filter out rows based on a condition that is more efficient than the dataview.rowfilter? Public Sub filterDataSource(ByVal filter As String) Dim tempSelectedValue As Object If IsNothing(Me.SelectedValue) = True Then tempSelectedValue = "-1" Else tempSelectedValue = Me.SelectedValue End If Me.mDataViewCombo.RowFilter = filter Try Me.SelectedValue = tempSelectedValue Catch ex As Exception End Try End Sub The "Me.mDataViewCombo.RowFilter = filter" takes about 2 seconds to complete when there are about 700 rows and I was wondering if there was any other way to improve upon that. I have tried to "Me.mDataViewCombo.table.select(filter)", but this method does not seem to filter anything at all. Thank you. eatwork

      R Offline
      R Offline
      Robert Rohde
      wrote on last edited by
      #2

      The Select function returns an array of DataRow objects. Thus the DataView isn't affected. There is no real way to improve the RowFilter performance generally. But if I recall right you might get better results if you sort the DataView by the column you are filtering (if it is a simple expression with only one column) because it then uses some kind of internal index.

      E 1 Reply Last reply
      0
      • R Robert Rohde

        The Select function returns an array of DataRow objects. Thus the DataView isn't affected. There is no real way to improve the RowFilter performance generally. But if I recall right you might get better results if you sort the DataView by the column you are filtering (if it is a simple expression with only one column) because it then uses some kind of internal index.

        E Offline
        E Offline
        eatwork
        wrote on last edited by
        #3

        Hi Robert, Thank you for the post and the information. I guess I am stuck with what I got. Thanks again. eatwork

        1 Reply Last reply
        0
        • E eatwork

          Hello all I was wondering if anyone out there knows of a way to filter out rows based on a condition that is more efficient than the dataview.rowfilter? Public Sub filterDataSource(ByVal filter As String) Dim tempSelectedValue As Object If IsNothing(Me.SelectedValue) = True Then tempSelectedValue = "-1" Else tempSelectedValue = Me.SelectedValue End If Me.mDataViewCombo.RowFilter = filter Try Me.SelectedValue = tempSelectedValue Catch ex As Exception End Try End Sub The "Me.mDataViewCombo.RowFilter = filter" takes about 2 seconds to complete when there are about 700 rows and I was wondering if there was any other way to improve upon that. I have tried to "Me.mDataViewCombo.table.select(filter)", but this method does not seem to filter anything at all. Thank you. eatwork

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          The only way to improve upon this is to not have 700 rows in your DataSet. You could requery the database for the smaller rowset, but that involves bugging the SQL Server again and transferring that data over the network again. Dave Kreskowiak Microsoft MVP - Visual Basic

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups