1
votes

I have gridview named myGridView with 800k rows. One of the columns is named NAME and it can have values Alex (1) where one is the number of current reccord for Alex. When I insert new reccord for Alex I want it to be with NAME value "Alex (n)" where n is the smallest number which is not taken. I think I should do some filter like this: var rows = (all objects in gridview).Select(rows where NAME.IndexOf( "Alex (" ) > -1)

And this will return me all the records for Alex ( some number) and now I have to filter by number I suppose... How to do the exact filter which to return me the smallest number which is not taken yet? Can it be faster?

1

1 Answers

0
votes

First, I should mention that the code you have pasted won't work. This is because the grid does not provide the rows collection. Also, even if this code works, it will work very slowly because it will result in filtering of 800k rows on the web server. Don't you think that it is better to request the required information from the DB server, which is optimized to work with such queries, and which will be able to process your request faster?