首页 > 解决方案 > The data is read very fast from sql server but displayed too slow on devexpress gridview

问题描述

I'm using vb.net 2017 , Entity Framework 6 with sql server 2008r2.

On my form I have a devexpress gridview. The gridview is bound to a Bindingsource ( MyBindingsource ) on design time.

My table on database has around 2300 records.

On runtime I have this code :

....

dim myquery as ienumerable(of Myobject)
myQuery=From t in Context.Myobject select t
Mybindingsource.Datasource=Myquery.Tolist

all these instructions are executed instantly , and I've checked that the query contains all the 2300 records , but after that It need 4 minutes to display all the records in Gridview.

What can I do ?

Thank you !

Update

I have investigated all the events that i'm using with my grid , and i have detected that all the problems were caused by this :

Private Sub gridView_CustomRowFilter(sender As Object, e As    DevExpress.XtraGrid.Views.Base.RowFilterEventArgs)
    Dim gridr As Object = gridView.GetRow(e.ListSourceRow)

    e.Visible = IsNothing(gridr) OrElse context.Entry(gridr).State <> Entity.EntityState.Deleted
    e.Handled = True
End Sub

With small data there's no problem , and this is why i have not noticed before. But i need this event because when the user delete a record , i don't delete it from bindingsource until the save button is pressed , but i want to hide from gridview.

What can i do ?

Thank you !

标签: vb.netwinformsentity-framework-6devexpress-gridcontrol

解决方案


推荐阅读