random access a table 
Author Message
 random access a table

Hi,
this sample could help you.

        Dim loCita As New clsCita(0, "", "", "S", msConnString)
        Dim lnCantidad As Integer
        Dim lnPos As Integer

        Dim loDataTable As New DataTable()
        loDataTable = loCita.mdtRecuperar
        lnCantidad = loDataTable.Rows.Count

-- > This is the code : generate a number from 0 to the number of rows you
have.

        Dim lnNumero As New Random()
        lnPos = lnNumero.Next(0, lnCantidad)

        Dim loRow As DataRow
        loRow = loDataTable.Rows(lnPos)
        lblCita.Text = CType(loRow("Cita"), String)
        lblAutorCita.Text = CType(loRow("Autor"), String)

--
Saludos;

Eladio Rincn
PASS Spanish Group


Quote:
> Hi,

> I want to randomly access the records in a table, eg. every time I loop
> through it I want a different sequence. Any ideas how to do that? I was
> thinking about a 'sequence' column that I fill with a random number and
then
> loop through the table in sequence of that column. The table isn't that
big
> so it's possible. Maybe there are better ideas?

> Thanks

> Frank



Sat, 05 Mar 2005 22:03:19 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. random access a table

2. Linking Access Tables in Different *.mdb Files, Populating an Access Table From Several Others

3. Random Access or Binary Access

4. open Access table = locked Access table??

5. open Access table = locked Access table??

6. Accessing Access Random Records

7. Linking Access Tables in Different *.mdb Files, Populating an Access Table From Several Others

8. open Access table = locked Access table??

9. Copying the structure of one Access table to a new Access table

10. Updating Field From Another Table Using Random

11. random selection of 25% of records in table

12. Random Number Generation isn't random if.....

 

 
Powered by phpBB® Forum Software