DataGridView + DataTable Speed

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • azraiyl@gmail.com

    #1

    DataGridView + DataTable Speed

    Hello,


    When I create a DataTable and add 10000 rows my computer needs about
    20ms. To delete 10000 rows it needs about 15ms.

    When I connect the DataTable to a DataGridView it needs 3100ms to add
    10000 rows and 6300ms to delete 10000 rows. That might be ok because
    the control needs an update.

    But when a disconnect the DataTable widht dgv.DataSoure = null it
    needs 420ms to add 10000 rows and 2430ms to delete rows.

    Can anyone explain what happened here and how I can modify the
    DataTable so I get the performance when it is never bound to a
    DataGridView?

    Thanks in advance for any response

    Azraiyl
  • Marc Gravell

    #2
    Re: DataGridView + DataTable Speed

    Well, how did you bind it to the dgv? Was there a BindingSource
    involved? Either way, controls (such as dgv) generally also speak to a
    CurrencyManager via their BindingContext, so it is quite possible that
    until you kill the form, that the ctx is still talking to the form
    [but without any UI to redraw any more, hence not as slow]; the
    BindingContext keeps a reference to the source as currency is shared
    between alike sources.

    Marc

    Comment

    • Ignacio Machin \( .NET/ C# MVP \)

      #3
      Re: DataGridView + DataTable Speed

      Hi,

      You need to provide more details, like if this is a win or a web based app.
      In any case 10K of rows are a little too much, you should reduce the number
      of rows. That will improve the performance al ot.

      --
      Ignacio Machin
      The #1 Warehouse Management System & Direct Store Delivery Software (DSD) for QuickBooks & ERP Systems – LaceUp Solutions

      Mobile & warehouse Solutions.
      <azraiyl@gmail. comwrote in message
      news:4ee89d95-191f-420a-888e-837860e339f9@i2 9g2000prf.googl egroups.com...
      Hello,
      >
      >
      When I create a DataTable and add 10000 rows my computer needs about
      20ms. To delete 10000 rows it needs about 15ms.
      >
      When I connect the DataTable to a DataGridView it needs 3100ms to add
      10000 rows and 6300ms to delete 10000 rows. That might be ok because
      the control needs an update.
      >
      But when a disconnect the DataTable widht dgv.DataSoure = null it
      needs 420ms to add 10000 rows and 2430ms to delete rows.
      >
      Can anyone explain what happened here and how I can modify the
      DataTable so I get the performance when it is never bound to a
      DataGridView?
      >
      Thanks in advance for any response
      >
      Azraiyl

      Comment

      • azraiyl@gmail.com

        #4
        Re: DataGridView + DataTable Speed

        @Marc Gravell

        I did bind it with "dgv.DataSo urce = dt". Thanks for your information
        about this CurrencyManager , have first to google about it.

        @Ignacio Machin

        It doesn't matter if i add 1000 or 10000 rows, after binding the
        insert/delete operations are slow, before binding insert/delete
        operations are fast. It is a windows application.

        Comment

        Working...