Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7939721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:11:22+00:00 2026-06-03T23:11:22+00:00

On a winform, in a datagrid, I am displaying about 100k rows, selected from

  • 0

On a winform, in a datagrid, I am displaying about 100k rows, selected from the DB. Showing all these records take a lot of time. Is there a way to make the select query faster or maybe load the first 200 records. And then if the users click the next button, the next 200 records will be displayed. Is this possible? I know mysql has LIMIT, but I need something to work for sql-server 2008.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T23:11:24+00:00Added an answer on June 3, 2026 at 11:11 pm

    Stored Proc

    Alter Proc Test
    @PageNumber int,
    @PageSize int
    
    as
    
    create table #t
    (
        id int
    )
    insert into #t(id)values(1)
    insert into #t(id)values(2)
    insert into #t(id)values(3)
    insert into #t(id)values(4)
    insert into #t(id)values(5)
    insert into #t(id)values(6)
    insert into #t(id)values(7)
    insert into #t(id)values(8)
    insert into #t(id)values(9)
    insert into #t(id)values(10)
    
    declare @StartIndex int
    declare @EndIndex int
    declare @PageSizeIndex int
    
    Set @StartIndex = ((@PageNumber - 1) * @PageSize) + 1
    Set @EndIndex = @PageNumber * @PageSize
    
    Select RowID, ID From
    (
        Select ROW_NUMBER() Over(Order by id) as RowID, ID From #t
    )K
    Where K.RowID >= @StartIndex and k.RowID <= @EndIndex
    
    Drop table #t
    

    Testing Purpose Data testing

    Test 1, 3
    

    In addition to the above Stored Proc, You can implement Indexes to make the search fast or you can use SQL Profiler to check the reason for delay in execution time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get the selected row value from a DataGrid in WPF,
In winform app i have a datagridview for showing the database values. i use
In winform application, how do I give a different (different from the blue one)
In the winform it has child forms and I use these codes for being
I'm creating winForm app,In that Onbutton click i gather Data Tables from of Two
I have a c# winform application (2008) with datagridview bound to data from sqlserver.
I have a winform in vs2008 that contains a DataGridView. The datagrid contains a
I have a .NET 4 WinForm application. I have bound a DataGrid to a
I have a Winform dialog that contains several user controls - all of them
I want to ask more to show data from SQL Server to WinForm using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.