By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,417 Members | 904 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,417 IT Pros & Developers. It's quick & easy.

Dataset & Datareader

P: n/a
Hello,

How can I get Random data from Dataset or datareader
THanks

--
Regads,
Rochdi
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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
Nov 21 '05 #2

P: n/a
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

"Mike" <Mi**@discussions.microsoft.com> escribió en el mensaje
news:5B**********************************@microsof t.com...
Hello,

How can I get Random data from Dataset or datareader
THanks

--
Regads,
Rochdi

Nov 21 '05 #3

P: n/a
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
--
Regads,
Rochdi
"Cor Ligthert [MVP]" wrote:
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

Nov 21 '05 #4

P: n/a
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/de...classtopic.asp

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

I hope this helsp,

Cor

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.