vb random record selection

i use ms access as back side of application.
and front side is visual basic.
i want to get random record from access table to visual basic form for online examination software.


please send answer as soon as



thanking for cooperation
 
Code:
[COLOR=Blue]Private[/COLOR] [COLOR=Blue]Sub[/COLOR] PrintRows(dataSet [COLOR=Blue]As[/COLOR] DataSet)
[COLOR=Green][/COLOR]     [COLOR=Blue]Dim[/COLOR] thisTable [COLOR=Blue]As[/COLOR] DataTable
     [COLOR=Blue]For[/COLOR] [COLOR=Blue]Each[/COLOR] thisTable [COLOR=Blue]In[/COLOR]  dataSet.Tables
         [COLOR=Blue]Dim[/COLOR] row [COLOR=Blue]As[/COLOR] DataRow
         [COLOR=Blue]For[/COLOR] [COLOR=Blue]Each[/COLOR] row [COLOR=Blue]In[/COLOR]  thisTable.Rows
             [COLOR=Blue]Dim[/COLOR] column [COLOR=Blue]As[/COLOR] DataColumn
             [COLOR=Blue]For[/COLOR] [COLOR=Blue]Each[/COLOR] column [COLOR=Blue]In[/COLOR]  thisTable.Columns
                 Console.WriteLine(row(column))
             [COLOR=Blue]Next[/COLOR] column
         [COLOR=Blue]Next[/COLOR] row
     [COLOR=Blue]Next[/COLOR] thisTable
[COLOR=Blue]End[/COLOR] [COLOR=Blue]Sub[/COLOR]

'Use this "rval" as "row(rval)" and set
'upperbound = thisTable.Rows.Count
'lowerbound = 1
rval = [COLOR=Blue]CInt[/COLOR](Int((upperbound - lowerbound + 1) * Rnd() + lowerbound))
 
Top Bottom