Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
|
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion 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 January 13th, 2013, 05:45 PM
Authorized User
 
Join Date: Apr 2005
Posts: 71
Thanks: 23
Thanked 0 Times in 0 Posts
Default Beginning ASP.NET 4 By I. Spaanjaars Page 461

Hi Folks, in the above book in page 461 a QueryString is setup (fig 13-16) in the where clause. Can someone explain what is going on as I can't understand exactly what is going on. Specifically the syntax [Id] = @Id.

In advance, many thanks
Mark
 
Old January 14th, 2013, 08:17 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

The QueryString parameter is used to influence the SQL statement so it only selects the review whose ID is in the query string (in the address of the page; e.g. something like ?Id=123 would retrieve review 123).

The part:

[id] = @id

contains two important sections. [Id] refers to the Id column of the Review table. It's used in the WHERE Expression like this:

SELECT .... FROM Review WHERE [Id] = 123

In this example, the value for the ID is hardcoded to 123. In the example on page 461, the ID comes from the Id Query String parameter. The @id part is a placeholder that .NET fills with the ID retrieved from the query string, resulting in the correct review from being retrieved.

Does clarify things?

For future questions that are directly related to the book, can you please post in the book's own forum category at http://p2p.wrox.com/book-beginning-asp-net-4-c-vb-560/ ?

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
markhh (January 22nd, 2013)
 
Old January 22nd, 2013, 07:30 PM
Authorized User
 
Join Date: Apr 2005
Posts: 71
Thanks: 23
Thanked 0 Times in 0 Posts
Default

Hi Imar, and many thanks for your prompt informative reply again. Chapter 14 of your book is good stuff.

Regards
Mark





Similar Threads
Thread Thread Starter Forum Replies Last Post
Error 461 Garouda VB Databases Basics 4 June 2nd, 2011 10:32 AM
Beginning ASP.NET 2.0 Chapter 4 page 111 gvecino BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 7 December 2nd, 2006 01:36 PM
Beginning ASP.NET 2.0 - Chapter 6 - page 196 warren_banks BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 September 2nd, 2006 08:21 AM
Help 'beginning asp.net using vb.net' source code jkmf Wrox Book Feedback 1 January 18th, 2004 08:09 AM
Beginning ASP.Net Databases Using VB.Net ISBN 6195 tlamazares SQL Server ASP 1 December 15th, 2003 01:28 PM





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