开发者

Data loading on DataGrid

I am using a DataGrid (.NET 1.1) to which data is being bound from data source which gets almost 3000 rows and 25 columns. Because of heavy data, it is taking around 3 minutes to load data on to datagrid. I want to load first 50 records, then next 50 , then next 50... so on...

How can I ac开发者_运维知识库hieve this ?.. I tried using Paging option but it loads whole records..

Any ideas?


Is this the kind of functionality you are looking for?

    Me.DataGrid1.DataSource = DataRange(5, 25, DataSet1.Tables(0))

.

  Private Function DataRange(ByVal Min As Integer, ByVal Max As Integer, ByRef SourceTable As DataTable) As DataTable
    Dim TempTable As DataTable = SourceTable.Clone
    If Max > SourceTable.Rows.Count Then
      Max = SourceTable.Rows.Count
    End If
    For i As Integer = (Min - 1) To (Max - 1)
      TempTable.ImportRow(SourceTable.Rows(i))
    Next
    Return TempTable
  End Function

As decompiled said, make sure the slowness isn't in your query.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜