Wednesday, March 11, 2009

Linq To SQL Visual Studio Visualizer

LINQ to SQL Debug Visualizer
I found the coolest tool for linq on Scott Guthrie's blog. A plugin that will show you the sql that is generated by a linq to sql statement if you hover over it in debug mode. WOW does this make life easier!

Download here.

Scott shows you how to use it here.

Tuesday, March 10, 2009

Free ASP.NET MVC eBook PDF

This is actually pretty cool. The ASP.NET MVC 1.0 book has gone into publishing and you can download the first chapter (All 195 pages of it) for free. The goes over the creation of an MVC project called Nerdinner which is actually available for free here. If you are at all interested in ASP.NET MVC you will want to check it out. 

Cheers!

Thursday, March 5, 2009

SQL Stored Procedure Example

For you guys over in Yakima who want to see some more SQL I thought I’d whip up a quick example of a pretty typical stored procedure that could have been used on my Digital Gamer Zone website. Here is the relevant diagram for the SQL I will be writing.

For this example I want to create a stored procedure that will return the ASIN and Title of all the games associated with a particular UserId. The ASIN is actually Amazon Standard Identification Number. If you have gone to http://digitalgamerzone.com/ , registered and gone to the “My Games” tab on you will find a huge library of games from which to drag and drop Into your personal Library. Now I sure as heck did not download those by hand. I created a small app that would download them for me after hitting an Amazon web service to find all the Xbox games that Amazon sells. If it’s good enough for Amazon, it’s good enough for me.


USE [MyGameSiteDB]
GO

SET ANSI_NULLS ON
GO
SET
QUOTED_IDENTIFIER OFF
GO
Create PROCEDURE [dbo].[GetUserGames] (
@UserID NVARCHAR(36)
)
AS
BEGIN

Select Distinct g.ASIN,
g.Title
FROM MyGames mg
Join Games g on mg.ASIN = g.ASIN
Where
mg.userid=@UserId

End


This example is ridiculously simple but at least it’s real. Who want s to see another Select * from Employees example? Not me!

Also, though my score is currently low. I will pwn you on Halo 3! That’s right, I said it!