LINQ to SQL: Querying the Database

This video shows how to execute any arbitrary SQL through the ExecuteCommand syntax and encapsulating the code through the partial DataContext class.

Presented by Scott Stanfield

Duration: 4 minutes, 9 seconds

Date: 13 March 2008

Watch the video   |   Get VB code  or  C# code

Video downloads: WMV | Zune | iPod | PSP | MPEG-4 | 3GP

Audio downloads: AAC | WMA | MPEG-4 | MPEG-3 | MPEG-2

Comments : 5

Leave a Comment

agarwaen : On March 17, 2008 8:05 PM said:

I know everyone is excited, so I be a bit more critic to this video podcast.

1. IMHO it is too short and too fast to the point. Not touching  it more deeply, i.e. why we are extending DataContext class instead of building our own factory, or it gets to the ExecuteCommand method just in the end of the video and then it immediately finish.

2. Would be better if Scott first of all told something about advantages/disadvantages of using SQL instead of LINQ (just a quick info and guide where to look for LINQ generated SQL statements), and touch in a bit more detail the ExecuteCommand method.

3. when will you support the "new" iPod Touch screen resolution in podcasts? It isn't much of a enjoyable experience watching them in present low-resolution state.

Thank you

mahir78 : On March 18, 2008 5:36 AM said:

Its Great that Microsoft offers world's smallest tutorials for their new products! Hats off to you. :(

atarikg : On March 20, 2008 7:35 AM said:

Well kinda fast yet nice :)

Nezdet : On March 25, 2008 7:47 AM said:

Fulltext Search I need to use pass through SQL to LINQ

Are there some exemples how to do it??

Lee Dumond : On April 08, 2008 1:35 PM said:

Just would like to point out a couple of errors in the code:

In part9.aspx, line 31:

Product p = db.Products.Single(p => p.ProductName == "Foo");

You can't declare a local variable "p" in the lambda expression here, because "p" is already used to denote the Product. You could change it to something else, like:

Product p = db.Products.Single(prod => prod.ProductName == "Foo");

In Helpers.cs, line 57:

return ExecuteCommand("delete from products where ProductId={0}", instance.ProductID);

DeleteProduct is a void method, so it can't return anything.  You need to get rid of the "return" keyword.

Leave a Comment

You must be logged in to leave a comment. Click here to log in.

Featured ASP.NET 3.5 Web Hosting


Featured ASP.NET 3.5 hosting offer from AppliedI.net

Click Here To Learn More...