Link to home
Start Free TrialLog in
Avatar of Moti Mashiah
Moti MashiahFlag for Canada

asked on

Querying data Linq asp.net mvc

Hi guys,

I am querying a Sql database with LINQ and I listed to show it in view. The problem is the data which come from sql is pretty big like around 100000 rows and when it sends to the view it is very slow.
How can I query this data in a quick way and show the list to the view

Here is my example:
Linq:
var translist = (from b in rmdb.Batches
                             join c in rmdb.Registers on b.RegisterID equals c.ID
                             select new Searchmodel
                             {
                                 Batch = b.BatchNumber,
                                 Registernum = c.Number,
                                 Registername = c.Description,
                                 OpenTime = b.OpeningTime,
                                 CloseTime = b.ClosingTime,
                             }).OrderBy(a => a.Batch).ToList();

Open in new window



The purpose I'm doing it is to let users search true the list and get the transaction they are looking for.

Here is my view example:
User generated image



I have 2 tables POINTS (with around 100 000 rows) ,
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Moti Mashiah

ASKER

Actually you said that paging its the solution in this case?
To your statement, "Actually you said that paging its the solution in this case? ", no that is NOT what I said. That can be an option if you need to bring back all the data. You state in the question, "The purpose I'm doing it is to let users search through the list and get the transaction they are looking for.", well if they know what they want why not just return those records by using a filter on the query?
LOL....I was just putting a statement "Actually you said that paging its the solution in this case?" to make sure your best suggestion is paging then I would go that way.

Actually, you gave me a good idea maybe I just popup blank window with search textbox and implement autocomplete options then query the data from with ajax back to the user.

What is your thought with this idea?

Thank you Fernando.
That sounds good.
Fernando,

Do you think that autocomplete will give me issue with this crazy amount of record?

like I can start sorting after 3 characters.
I am sorry, I have misunderstood your last question. You will still have the same issue.

Out of these column names, BatchNumber, Number, Description, OpeningTime, ClosingTime what is the user looking for so that maybe we can build a filter.
K thabk you very much Fernando.