The DataTable contains the Rows
property, which is a DataRowCollection
. You can access each of these lines using an index.
That way you can get a random number using Random
and get the data from myTable.Rows[myRandomIndex]
.
Random random = new Random(); int randomNumber = random.Next(0, 50);
source share