Results 1 to 4 of 4

Thread: unable to implement sqldatareader to icollection

  1. #1
    Join Date
    Nov 2008
    Posts
    109

    unable to implement sqldatareader to icollection

    I wanted to create a new query that should return only the specific range of records when we ask for, I have also decided to use a SqlDataReader instead of a DataSet this is because there is no need to update the data and SqlDataReader is purportedly much faster. Can any one please suggest me how to Implement paging in a DataGrid that has an SqlDataReader as source?

  2. #2
    Join Date
    Mar 2008
    Posts
    232

    Re: unable to implement sqldatareader to icollection

    ICollection is an interface that provides the several methods of SqlDataReader which result in an ExecuteReader command to an SQL statement. By just setting the AllowPaging property to True and (optionally) setting the PageSize property, the DataGrid displays only the first PageSize number of rows from the DataSource.

  3. #3
    Join Date
    Oct 2008
    Posts
    167

    Re: unable to implement sqldatareader to icollection

    DataSource of datagrid must use classes that were inheritance from interface ICollection. ICollection is an interface that provides the several methods that the DataGrid uses behind the scenes for paging. Interface ICollection has property Count. And SqlDataReader does not have this property. Google, obviously, is not the only Web site that breaks up large amounts of data into readable pages.

  4. #4
    Join Date
    Mar 2008
    Posts
    192

    Re: unable to implement sqldatareader to icollection

    Along with the AllowPaging property, there is a PageSize property that specifies how many records to display per page. So do people who want to use a SqlDataReader first read results into a, say, ArrayList or DataTable in the code-behind This property has a default value of 10. Apparently, you CAN set a datagrid's DataSource to a DataReader--but you must set AllowCustomPaging to true.

Similar Threads

  1. Abstract class unable to implement List<T>
    By MAHESA in forum Software Development
    Replies: 5
    Last Post: 02-03-2010, 09:00 PM
  2. Implement the copy_backward() in C++
    By Agustíne in forum Software Development
    Replies: 5
    Last Post: 16-02-2010, 09:46 PM
  3. Feed a dataSet from a SqlDataReader
    By Layton in forum Software Development
    Replies: 5
    Last Post: 23-01-2010, 10:25 AM
  4. How to implement IP Sec
    By Enriquee in forum Technology & Internet
    Replies: 5
    Last Post: 12-01-2010, 06:28 AM
  5. Implement Java tic tac toe
    By SmokiN in forum Software Development
    Replies: 3
    Last Post: 29-06-2009, 09:09 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,887,412.78818 seconds with 17 queries