Questionable SQL-statement?
In the Details.cshtml file of site Classifieds from chapter 12 (page 299 in the book) is the following statement:
var sql = "SELECT * FROM Items, Categories WHERE Id = @0";
Shouldn't this rather be something like:
var sql = "SELECT *, Category FROM Items JOIN Categories ON Items.CategoryId = Categories.CategoryId WHERE Id = @0";
Otherwise, one always gets the Electronics category in the Details page?
__________________
Regards,
Gudni G. Sigurdsson
|