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

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 3b7d0 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |