Mohsen Moghadam

Mohsen Moghadam

  • NA
  • 17
  • 2.1k

Problem in searching in database

Nov 22 2015 7:38 AM
i use a sample named "Searching And Paging In MVC" in your web site.
 
and change it to this :

public class HomeController : Controller

{

SerialPOS db = new SerialPOS();

public ActionResult Index(string Searchby, string search)

{

var Serial = from SerialPOS in db.SERIAL_NUMBER select SerialPOS;

if (Searchby == "SERIAL_NUMBER")

{

var model = db.SERIAL_NUMBER.Where(s => s.SERIAL_NUMBER(search)).ToList();

return View(model);

}

else

{

var model = db.ACPTR_NAME.Where(s => s.ACPTR_NAME.StartsWith(search) || search == null).ToList();

return View(model);

}

}

} 
 
but i have error on "s => s.SERIAL_NUMBER(search)" , after second s stop and give this error:
 
'char' does not contain a definition for 'SERIAL_NUMBER' and no extension method 'SERIAL_NUMBER' accepting a first argument of type 'char' could be found (are you missing a using directive or an assembly reference?)
 
please help me 
thank you

Answers (2)