With Each Step Forward, Microsoft Takes Two Back

Today I was browsing a Microsoft published document on creating ASP.NET Web Pages using the Razor Syntax and to my surprise I found this gem on page 65. @{ var db = Database.OpenFile("SmallBakery.sdf"); var selectQueryString = "SELECT * FROM Products ORDER BY Name"; } <!DOCTYPE html> <html> <head> <title>Small Bakery Products</title> <style> h1 {font-size: 14px;} table, th, td { border: solid 1px #bbbbbb; border-collapse:collapse; padding:2px; } </style> </head> <body> <h1>Small Bakery Products</h1> <table> <thead> <tr> <th>Id</th> <th>Product</th> <th>Description</th> <th>Price</th> </tr> </thead> <tbody> @foreach (var row in db.Query(selectQueryString)){ <tr> <td>@row.Id</td> <td>@row.Name</td> <td>@row.Description</td> <td>@row.Price</td> </tr> } </tbody> </table> </body> </html> In case you missed it here is the meat of the problem I have with this example: ...

August 9, 2010 · 5 min · 870 words · Nick Berardi