Correct way to bind a Datagridview

Asked

Viewed 58 times

1

I’m bindando one DataGridView in a DataTable what a comeback from my comic book, but even with just 79 records in the DataTable my DataGridView is very slow to work and catching on the screen scroll.

Is there any better way for me to accomplish this bind so that it becomes more performatic?

There is more recommended way?

DataTable dtDados = DataAccess.ExecutaComando("SELECT ID, TOPICO_PTBR, TOPICO_ENUS, TOPICO_ESES, CONTEXTO_PTBR, CONTEXTO_ENUS, CONTEXTO_ESES, TEXTO_PTBR, TEXTO_ENUS, TEXTO_ESES, DATALT, REVISADO_ENUS, REVISADO_ESES FROM HELP ORDER BY TOPICO_PTBR");
dataGridView1.DataSource = dtDados;

Number of records returned by query: 79.

  • include your gridview’s Markup in the question

  • What would Markup be? @Leandroangelo

  • the code of the aspx

  • It’s in Windows Forms...

1 answer

0

Slow with just this amount of records? Pretty weird even... I usually fill out a generic list and step via a loop, I think it’s faster.

Datatable uses a lot of computer memory, many even indicate not to use it directly. When I use data table, it is usually in the data layer but always using a record limiter like Maxreg and Startreg of Dataadpter. But this is in case you have many records, where you need to make a pagination for example.

But even so... it is not normal to happen that already solved?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.