13.07.2015 Views

ASP.NET 3.5: A Beginner's Guide - www.mustafaof.com

ASP.NET 3.5: A Beginner's Guide - www.mustafaof.com

ASP.NET 3.5: A Beginner's Guide - www.mustafaof.com

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

368<strong>ASP</strong>.<strong>NET</strong> <strong>3.5</strong>: A Beginner’s <strong>Guide</strong>Figure 14-12 Output filtered through a LINQ querythe <strong>ASP</strong>.<strong>NET</strong> Label web control. When you test the application, Figure 14-12 shows whatyou should see.While this is a simple example, it shows the functionality of a LINQ query usedto filter data using the LINQ query statements. The fabulous IEnumerableexpression is assigned the values of the prices array if they meet the query requirements.Then the data are extracted using a foreach statement. Yet the entire process isremarkably simple. Applied to a database, the same structure can be used. The onlydifference is the data source.SummaryFor those who have toiled in the fields of database queries, LINQ will be a wel<strong>com</strong>e relieffrom the peccadilloes characteristic of SQL. Not only can queries be made without havingto concern oneself with which version of SQL is required, but also the queries use fairlynormal programming constructs in C#.With the new <strong>ASP</strong>.<strong>NET</strong> <strong>3.5</strong> LinqDataSource control, you can easily bind to a displaycontrol. The DetailsView control is ideal because of its AutoGenerateDeleteButton, AutoGenerateEditButton, and AutoGenerateInsertButton properties.With these properties, all of the necessary query and nonquery operations that typically

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!