Dataset & Datareader

  • Thread starter Thread starter Guest
  • Start date Start date
Mike,
How can I get Random data from Dataset or datareader
Can you explain more what you mean with this. (as well if you are talking
about if this is a winform or a webform application).

A dataSet uses a dataadapter to fill its tables, where the datadapter uses a
datareader object.

Cor
 
Unless your select statement has an "ORDER BY" clause, the data from the
database is not guaranteed to be ordered. If you really need things of
random nature, use the System.Random class of the .NET Framework.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 
It just a normal winform and the dataset or datareader is getting data from a
table. how can I get random rows from this dataset or reader
 
Mike,

In addition from Carlos, the data is not ordered however the data will
always be supplied in the same way.

Every dataset has datatables which have rows. The rows is what you need to
get with the again as Carlos told used randomizer to get a number from 0 to
ds.tables(0).rows.count -1

http://msdn.microsoft.com/library/d...us/cpref/html/frlrfsystemrandomclasstopic.asp

A row is than
dim myrandowrow as datarow = ds.tables(0)(therandomizerfoundnumber)

I hope this helsp,

Cor
 

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

Back
Top