Wednesday, August 6, 2008

Quiz of the week

Identify the following code snippet:


3 comments:

Deepthi Babu said...

This code snippet is implementing LINQ to SQL.

The DataContext class will be named as NorthwindDataContext and this can be used to do operations against the database.

First example is selecting data.

Second example is updating data.
Explanation:-
1. Getting one row from the Products table.
2. Updating two of its columns UnitPrice and UnitsInStock and submitting the changes to database.

Akhila said...

This .net code is achieved thru LINQ to SQL to select data from database

Subash Gaffhill said...

The first code snippet uses LINQ (Feature in VS2008) expression to find the list of products whose Category name is "Beverages"

The next code snippet uses LINQ expression to find a single product with Product name "Toy 1" and then updates the UnitPrice and UnitInStock.

For more information about LINQ, see the following links:

http://msdn.microsoft.com/en-us/library/bb308959.aspx

http://en.wikipedia.org/wiki/Language_Integrated_Query