Wrox Programmer Forums
BOOK: Beginning ASP.NET Web Pages with WebMatrix
This is the forum to discuss the Wrox book Beginning ASP.NET Web Pages with WebMatrix by Mike Brind, Imar Spaanjaars ; ISBN: 978-1-1180-5048-4
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET Web Pages with WebMatrix section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 6th, 2012, 04:49 PM
Authorized User
Join Date: Dec 2010
Posts: 27
Thanks: 10
Thanked 0 Times in 0 Posts
Default 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?
Gudni G. Sigurdsson
Old August 9th, 2012, 09:26 AM
Wrox Author
Join Date: Dec 2011
Posts: 57
Thanks: 1
Thanked 19 Times in 19 Posts

Yes - you are right.

Similar Threads
Thread Thread Starter Forum Replies Last Post
convert a SQL Statement from MS Access to a SQL Corey Access 6 March 28th, 2007 12:33 PM
SQL Statement SAMBUSA SQL Language 2 December 1st, 2004 11:10 AM
SQL Statement help johnman Access 1 October 22nd, 2004 10:20 AM
SQL Statement stu9820 ASP.NET 1.0 and 1.1 Basics 1 September 30th, 2003 04:30 PM
sql statement chrisangus@btinternet.com Beginning VB 6 2 June 23rd, 2003 04:28 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.