Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The issue I am having is that I want to find a row at a specific position. However, I do not want to start the enumeration back at 0 or 1.

if I find my first row as position 1000 I want to start back at 1000 and keep moving forward until I find the next row. So, If I have a second row found at position 5,000 then I want to start from there....etc.

this will keep the search time to a minimum. I noticed that if a row is found 100,000 + rows later the amount of time spending to find the row increases by quite a bit.


Public Function get_row(table_name As String, column_name As String)

        Dim row_pos As String

        Dim sampleResults = From sampleRow In IDlibrary.Tables(table_name).AsEnumerable() Where sampleRow.Field(Of Integer)(column_name) = CallByName(nwindividual, "Individual_ID", CallType.Method, Nothing) Select IDlibrary.Tables(table_name).Rows.IndexOf(sampleRow)

        row_pos = sampleResults(0)

        Return row_pos

    End Function


what I am looking for would be something like this x is the number that changes based on row position found
IDlibrary.Tables(table_name).rows( x &": whatever the full table amount is") I know this is not how it works but trying to show you what I am talking about.


I have seen were a dataadapter would fill a range:
DataAdapter.Fill(Dataset, 5, 3, "tablename")
I am looking for something like that but with an already filled data table in a dataset.

What I have tried:

I have tried to research methods of a asnumerable select range. I could not find anything. I figured that someone might have tried this before and could help me under stand how to achieve this.
Posted
Updated 3-Jul-20 22:00pm

1 solution

 
Share this answer
 
Comments
Garth J Lancaster 4-Jul-20 4:11am    
nice - here was I thinking of yields, ElementAt ....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900