Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I am developing a web project in C # and I have a big question at the moment I need to make some selects on my DB. The database may contain hundreds to thousands of data, which I intend to return in a few queries also hundreds and / or thousands of data to be displayed in a gridview, and this grid has paging.

SQL
I just need to know what is the best way to do this since they do not want to overload my application at query time. I want to know what the best approach, whether it is by completing the grid with a datasource that returns the data directly from the database, whether it is through a dataset and TableAdapter, or is otherwise.

need this help please and an explanation or sources where I can study and better understand this situation. thank
Posted
Comments
ZurdoDev 29-Jul-13 9:28am    
Best way depends on many things and everyone will have a different opinion.
Silvabolt 29-Jul-13 15:30pm    
Might want to look up entity framework. Basically it creates an entity model representation of your data tables, and it generates basic CRUD operation queries for you so you don't have to make too many custom queries. But like ryan said, it depends on many things on what is the "best" way.
nikhil-vartak 30-Jul-13 0:48am    
Instead of using built-in paging feature in Gridview, write a custom pagination logic that will fetch only few rows of data from database according to current page number. SqlDataAdapter.Fill() method has an overload which takes startRecord and maxRecords parameters and allows you to select specific rows from SQL table. So if user clicks on page#2 of gridview, you pass (page_num - 1) * page_size as a startRecord of new result set.

This is unlike built-in paging feature in which you have to rebind whole grid everytime user select different page from pager.
fasher_the_one 30-Jul-13 5:13am    
Nikhil,

thats the way that i need i my app, so i don't know how to build this solution yet. do you have some totorials that can gide me to the solution??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900