17.07.2015 Views

The Art of SQL Server FILESTREAM - Red Gate Software

The Art of SQL Server FILESTREAM - Red Gate Software

The Art of SQL Server FILESTREAM - Red Gate Software

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 5: <strong>FILESTREAM</strong> with ASP.NET and SilverlightNow, in the SSMS window run the code in Listing 5-13 to create the stored procedure.CREATE PROCEDURE GetItemListASBEGINSELECT ItemNumber ,ItemDescription ,'/GetItemImage.aspx?ItemNumber=' + ItemNumber AS ImageURLFROM ItemsENDListing 5-13:Creating a stored procedure to retrieve item information.Notice the third column returned by the stored procedure; the value returned by thiscolumn points to the page we created in the previous lab to return images from thedatabase. <strong>The</strong> value returned by this column will be used to bind the image control on thegrid that will display the thumbnails. Run the application we created in the previous laband load a few more images into the <strong>FILESTREAM</strong> table.Listing 5-14 shows an example results set from the stored procedure, based on the data Ientered for this demonstration.ItemNumber ItemDescription ImageURL---------- --------------- ----------------------------------1001 Micros<strong>of</strong>t Mouse /GetItemImage.aspx?ItemNumber=10013001 Dell Laptop /GetItemImage.aspx?ItemNumber=30014005 Apple iPad /GetItemImage.aspx?ItemNumber=40056009 Amazon Kindle /GetItemImage.aspx?ItemNumber=6009Listing 5-14:Example results from the stored procedure.195

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

Saved successfully!

Ooh no, something went wrong!