If you really only want n records .net can fill a DataTable with n records.
Probably a better choice than asking .net for all records and then stopping. There is also a Top command that should be used. Select TOP 8 * from blah or somesuch. On 6/24/05, Mike Belcher <[EMAIL PROTECTED]> wrote: > What I did is make a variable in the while loop and at the I had added a > AND > to it....... works great. > > While objDataReader.Read() And intTotalMatches < 8 > > > so when it is 8 it breaks out.................. :) > > > -----Original Message----- > From: [email protected] > [mailto:[EMAIL PROTECTED] On Behalf > Of Ian Payne > Sent: Friday, June 24, 2005 8:56 AM > To: [email protected] > Subject: RE: [AspNetAnyQuestionIsOk] Relational Database Design Group > > You could try (in both senses!) > > int readRecordsCount = 0; > while(reader.Read()) > { > // do some stuff... > if(readRecordsCount++ > 6) > break; > } > reader.Close(); > > hth, > Ian > > -----Original Message----- > From: [email protected] > [mailto:[EMAIL PROTECTED] On Behalf > Of Mike Belcher > Sent: 23 June 2005 22:59 > To: [email protected] > Subject: RE: [AspNetAnyQuestionIsOk] Relational Database Design Group > > While objDataReader.Read() > > > I have code that ckecks if the record count is > than 6 and if so I want > the > datareader to not read more records and move the pointer to the end so that > when it hits the end while statement it will think it has read all the > possible records and be done. Is there a command to do this? > > > > > > Yahoo! Groups Links > > > > > > > > > > Yahoo! Groups Links > > > > > > > > > > ________________________________ > Yahoo! Groups Links > > > To visit your group on the web, go to: > http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ > > To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
