-1

I have datagrid and 90000 row.

Line 90000 datagrid open very late. 9 seconds to open. What is the best way to speed the opening of the?

My code:

string sqlSorgu = "SELECT "+
              " customer.id," +
              " customer.medaxil_status," +
              " customer.hesab_nomresi," +
              " customer.soyad ," +
              " customer.ad ," +
              " customer.ataadi ," +
              " customer.mebleg ," +
              " customer.teskilat_kodu" +

                   " FROM customer  ORDER BY customer.id ASC ";
                    OleDbDataAdapter dataAdapter = new OleDbDataAdapter(sqlSorgu, Program.esas.bazayaQosul);

                    setx = new DataSet();
                     datatabmedaxil = new DataTable();
                    setx.Tables.Add(datatabmedaxil);

                    dataAdapter.Fill(datatabmedaxil);
                    MedaxilGridView1.DataSource = datatabmedaxil;


            if (this.MedaxilGridView1.RowCount > 0)
            {
                for (int i = 0; i < this.MedaxilGridView1.RowCount; i++)
                {
                    if (this.MedaxilGridView1["medaxil_status", i].Value.ToString() == "1")
                        this.MedaxilGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Pink;
                    else
                        this.MedaxilGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Empty;
                }
            }

Please Help me

  • 2
    You want to Paginate your data. See [How can I paginate a WPF DataGrid?](http://stackoverflow.com/questions/784726/how-can-i-paginate-a-wpf-datagrid) – YetAnotherUser Jun 22 '12 at 19:32
  • 2
    If you had a 1500 page PDF file (90000 rows, 60 rows per page), would you print the whole thing or just the pages you wanted? – Mark Peters Jun 22 '12 at 19:32
  • 1
    Dumb question: Do you need to load all 90k rows? Does a user require that? – John Jun 22 '12 at 19:32
  • 1
    Don't show 90,000 rows. There is absolutely nothing constructive a user can do with a grid that shows that amount of data. – Oded Jun 22 '12 at 19:34
  • The client wants to place all rows. Other wise I pagnitation – Hayyam Hasanov Jun 22 '12 at 19:36
  • 2
    Winform? WPF? ASP.NET or something else? – Damith Jun 22 '12 at 19:50
  • And where is your data coming from? Does the query run within 1 second? That would give you another second to get all data in the grid. – rene Jun 22 '12 at 21:56

3 Answers3

1

While I agree with pretty much everyone else that 90,000 rows in a single view is completely unusable, sometimes the person paying the bills gets to make the stupid decisions....

It looks like this might be appropriate to your needs:

Implementing Virtual Mode with Just-In-Time Data Loading in the Windows Forms DataGridView Control: MSDN

Mark Peters
  • 17,205
  • 2
  • 21
  • 17
0

There is no simple straightforward solution I know.

Options I would consider using to keep it under control:

  • A search filter
  • Restricting the output to a reasonable line count (e.g 1000) and show a warning that the list was truncated.
  • Pagination (splitting result into pages)
alexm
  • 6,854
  • 20
  • 24
  • But I saw a program written in Foxproda. 140000 Line will be sent within 2 seconds I think that the way the C # – Hayyam Hasanov Jun 22 '12 at 19:41
  • DataGrid component does not offer _virtual_ mode to deal with large datasets. Pagination could be the closest thing. – alexm Jun 22 '12 at 19:45
  • If we have a problem with my program Pagnitaion. I textbox - look for the written word in rows datagrid. I am using for this purpose. I can not find the word 100.1000 paging in datagrid: ( – Hayyam Hasanov Jun 22 '12 at 20:18
0

Agree with the others that 90000 rows is not in any way usable. There is an article here on StackOverflow on paging:

Implementing paging using Linq

I also HIGHLY recommend you do not rely on the control to handle paging. All it will do is put those 90000 rows into memory and the page through them. Just as slow, just as horrible, and just as unusable.

In addition to paging you need to consider ways to reduce the set size down to a reasonable amount. Even with paging 90000 rows is way too much for anyone to deal with. This represents a User Experience of having to page through 1667 pages to get to the last record when displaying 54 items per page. Ask yourself, would you like to have to page through that many items to find what you want?

As to your Foxpro statement? Well there are many factors at play such as local vs remote, size of data, how the data was stored, etc. 140000 rows with 200 bytes of data coming off your local hard drive differs greatly from 90000 rows, serialized with XML, coming from a service that is going to a corporate server with 1K data in each row.

Community
  • 1
  • 1
SASS_Shooter
  • 2,186
  • 19
  • 30