How to use Where Equals Contains in SQL in MVC

Home > Search > How-to
  by

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());
}

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




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




Comments