nkewney
asked on
Gettting a random field from a DataTable
Dear Experts,
I'm trying to select a random row from a DataSet Table (dsBB).
The table has two columns, Field_ID and Field_Name
I'm generating a random number as follows:
Dim RandomNumber As Integer
RandomNumber = Int((dsBB.Tables(0).rows.c ount - 0 + 1) * Rnd()) + dsBB.Tables(0).rows.count
How can I select a random Field_Name from this DataTable and return it as a string?
Any help would be appreciated
Thanks
Nick
I'm trying to select a random row from a DataSet Table (dsBB).
The table has two columns, Field_ID and Field_Name
I'm generating a random number as follows:
Dim RandomNumber As Integer
RandomNumber = Int((dsBB.Tables(0).rows.c
How can I select a random Field_Name from this DataTable and return it as a string?
Any help would be appreciated
Thanks
Nick
ASKER
Thanks for that - could you give me an example if you get a minute?
Thanks
Nick
Thanks
Nick
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Absolutely spot on - thanks so much vbturbo:
Nick
Nick
You would create a random number that are <= the tables row count
Then pick the generated row number and what random generator has generated for you.
Then represent Field_Name from the select.
Cheers
vbturbo