What's wrong with the 'var' code you have? The var should work just fine and that's the proper way to declare this actually...
If you want to use the explicit type it's IQueryable< Client >.
+++ Rick ---
>Hi everybody,
>
>I am trying to write a Search method that can accept two parameters (no or Name). Here is what I've started, but I don't know how should I declare "clients" variable at the top correctly. What is it when used in LINQ query?
>
>
>public ActionResult Search(int? clientNo = null, string clientName = null)
> {
>
> if (((clientNo??0) == 0) && (String.IsNullOrEmpty(clientName)==true))
> {
> // Assume we want to select everything
> var clients = Db.Clients.OrderBy(c => c.Name);
> }
> var clients = Db.Clients.Where(c => (c.Number == clientNo)).OrderBy(c => c.Name);
>
> return PartialView("_ClientsSearch", clients);
> }
>
>Since I can not declare var clients twice, what will be correct solution here?
>
>Thanks in advance.