Techniques and Advice

N

.NET/C# User

I am working on a project that is heavily object oriented, and we are all
new to .NET. I am trying to do some research on best practice/patterns for
reading many records, and paging the data etc. I get the feeling people
will just use DataReaders maybe. But our problem is that the system is
ASP.NET, and we need some way of asking for a bunch of records between a
range. For example, say I know there are 500,000 records in a table I need
to render in IE, I dont want to load all of these records as objects and
then render the first 20. I seem to remember there were some techniques on
doing this by specifying a range.

Thanks for any advice.
 
G

Gerald Klein

if you dont want to load the whole set you will have to use SQl to do this.

that can be done a lot of ways but I am not aware of this range you speak
of.

IN grids you will have to use custom paging and write the range code
yourself
 
M

Martha[MSFT]

You can use a DataGrid control. You can bind a data source to a DataGrid and
it will automatically display the data records in your ASP.NET page. If you
don't want to display all the records at once, it has support for PAGING
THROUGH the records of a data source.

You enable paging for a DataGrid by enabling the "AllowPaging" property and
creating a subroutine to change the current page(you have to set the
CurrentPageIndex of your control and bind the dataGrid again). The other
important requirement for enabling paging is that your DataGrid control's
data source must implement the ICollection interface. A "DataReader"
DOESN'T implement this interface, so you have to use a "DataTable".
Of course, you can control the number of records to display (use the
"PageSize" attribute of your DataGrid).

Hope this helps,

Martha
 
N

.NET/C# User

Hi Martha,

What happens if I cannot use a data table? The database is queried, and from
the persistence layer a bunch of objects come back. Once I have these
objects, I then need to render them. It seems I need some way of requesting
a range fro an SQL query, to limit the results brought back, and to allow
the start and end range to be munged into a URL and used to query the DB.
However I dont know how to do this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top