I want to do the following but I don't know how:
- execute the select statement: "select * from firms"
- and binding this dataset to the DataGridView.DataSource component
Those first 2 steps are not a problem, if you retrieve the entiry resultset at once. However I only want to get the first x records from the database (so the other rows aren't send over the network yet) Those records are only retrieved (send over the network connection) if the user scrolls the DataViewGrid. Is this possible with the C# components?
I'll thank you in advance for an answer.
Loading
Munir ShaikhPosted Aug 2, 2007, 3:09 AM
Check this
SELECT emp_id,lname,fname FROM employee LIMIT 20,10
That says, give me 10 records starting at record 21. So what will be returned are rows 21-30. This is used heavily in web-based apps so you can do recordset paging.
But this will not work in MS SQL SERVER
Here is what you can do in MS SQL to emulate it (this runs on the PUBS db):
select * from (
select top 10 emp_id,lname,fname from (
select top 30 emp_id,lname,fname
from employee
order by lname asc
) as newtbl order by lname desc
) as newtbl2 order by lname asc
So in your case you need to pass the no of records to be displayed dynamically and again bind the GridView every now and then, or you need to this in memory.
It seems memory consuming.
Enjoy!!
>>Munnamax