Hi guys,

I found this forum in hope of finding a good place to find some other C# developers that could help me, and that I maybe could help with something else that I have experienced.
I'm using VS08 to develop and maintaince a customer application, running on a MSSQL08 Express.

Everything is working perfectly, but in the maintime there have been some performance leaks, in the search time for object presentation.
I should maybe note, that I'm using the good old WinForms as a UI for presentation.
The problem is, that as the application being used, the more data is getting stored in the DB ofc, and the more object items have to be searched through, and that increased the search and performance time dramatically!

So my issues is, do any of you guys have a suggestion to, how do I increase the search method, to speed things up, and make the performance faster?

I'm using a TreeView list to presentate the objects, and as link between the DB and the system, I'm using MS LinQ to SQL generation (.dbml).
the search code at the very moment that are used is:

public IEnumerable<Adresse> SearchAdresser(String pSearchString)
{
try
{
IEnumerable<Adresse> list = (from p in _context.Adresses where p.Street.StartsWith(pSearchString) || p.Floor.Contains(pSearchString) || p.Number.Contains(pSearchString) || p.Postalcode.Cityname.Contains(pSearchString) select p);
return list;
}
catch (Exception ex)
{
_errorclass.reportError("CRUDAdresse", "SearchAdresser", ex);
throw;
}
}

the code above show an example of the biggest search method, based on search on address where you can find items based on Streetname, Street number, Floor or Cityname.

One of the more simple searches are like the following:

public IEnumerable<Potential_customer> SearchPotential_customer(String pSearchString)
{
try
{
IEnumerable<Potential_customer> list = (from p in _context.Potential_customers where p.Name.StartsWith(pSearchString) select p);
return list;
}
catch (Exception)
{
throw;
}
}


this code above it not that flexible as if I used the p.Name.Contains(pSearchString) as an operator. But sadly enough, this make even more performance leaks....


The problem is there is currently around 1200-2000 objects that has to be shown on a search, and I ain't using Threads (due to its complexity and bad documentation of implementing in WinForms?), so when the system has to search 2000 rows thorugh the LinQ context, it gives a more or less short lockdown on user inputs on the UI (frozen UI for a moment), which is making it annoying....

so does any1 have a suggestion how I could increase the search performance, or an idea of which type of search algorithm I should be using instead???

Any helps are appriciated.
Best regards