≡ Menu

Datagridview Paging Technique Using Data Adapter & Stored Procedure

You all ever make a form to display or record a very large load on the grid for example in a grid have to load about 4 -10 million records? Sure enough khan also troublesome, especially for application performance. First saia already done it with TrueDBGrid (time still use VB6) which should load the millions of records into a single grid, it is quite risky for the performance … fortunately still helped with data retrieval model is asyncfect ado … But still a big risk for application performance, not to mention if the application is multiuser … can be more severe.

It turns out the solution of that is using paging in the DataAdapter or the Stored Procedure (TableAdapter).

With this technique application performance is getting good, safe and stable.

Here paging technique using Table Adapter (Stored Procedure) in VB.Net:

Ok … first we make the stored procedurenya first. This procedure Storde who do paging. It also used a new feature in SQL Server 2005 is the Common Table Expression (CTE) that we can use to create a virtual table (create table on the fly).

Used the AdventureWorks database, table table Production.Product

  1. Make stored procedure
  2. After that create a design form as below (label, numericupdown, Button, DataGridView)
  3. Add TableAdapter with a click on the Data menu> Add New Data Source, select Database as its DataSource object … After that, select Stored Procedure that have been made over … then the result will be creating a dataset with a TableAdapter
  4. Now we began to make his code. Add this code within the Form class is used:

  5. After that we will add a function to calculate the total number of records that exist in that table by using Partial Class. We will extend the TableAdapter class that has been generated at the top.

Download source code :

Here paging technique using Data Adapter in VB.Net:

  1. You create a Windows application project templates
  2. Add textbox control, numericupdown, buttons, the GridView, the label
  3. Add code like the following:

    Source code:

source: newbiebanget

{ 0 comments… add one }

Leave a Comment


This site uses Akismet to reduce spam. Learn how your comment data is processed.