Bootstrap FreeKB - MVC - Where Equals Contains in SQL
MVC - Where Equals Contains in SQL

Updated:   |  MVC articles

In your controller, use the following to return results where column1 contains xyz.

public ActionResult Index()
{
    return View(db.Example.Where(x => x.column1.Contains("xyz")).ToList());
}

 

Use the following to return results where column1 equals  xyz.

public ActionResult Index()
{
    return View(db.Example.Where(x => x.column1.Equals("xyz")).ToList());
}

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 6e8c03 in the box below so that we can be sure you are a human.