I'm working on an MVC web app using Entity Framework 6. I can't figure out why I can query with LINQ but context.Database.SqlQuery() doesn't work and always returns an invalid object name error for the table.
This works:
db.MatchHistory.Where(u => u.id == sumID).ToList().Count()
This doesn't. I also tried tblMatchHistory and dbo.tblMatchHistory.
db.MatchHistory.SqlQuery("SELECT * FROM [dbo].[tblMatchHistory] WHERE id = '" + sumID + "'").ToList().Count()
What am I missing? Or should I just not be using SqlQuery()?