Working through the WROX "Beginning ASP.NET MVC 1.0" book I've hit a strange 'error'.
"Operator '==' cannot be applied to operands of type 'System.Guid' or 'int'". The line in questions is:
(p => p.ID_Officers == id).Single();
The full code is below, and Officers is my table, ID_Officers is my ID field. (I imagine that I could of used 'o' instead of 'p')
public ActionResult IndividualOfficer(int id)
{
OfficersDataContext dataContext = new OfficersDataContext();
Officer officer = dataContext.Officers.Where
(p => p.ID_Officers == id).Single();
ViewData["OfficerName"] = officer.OfficerName;
ViewData["Officer"] = officer;
return View();
}
Any words of wisdom for this beginner would be appreciated.
I might add, that although this book was recommended for beginners - boy it's dry. It's clearly laid out, obvious to see what needs to be added/typed in during the exercises, but I feel it's written for an experienced programmer coming over to MVC. Rather than a beginner programmer.
So, does anyone know of a more beginner friendly book (I like books and reading) that I could more easily sink my time and teeth into?
Thanks for your help and guidance.
Mike