Ready To Go?
After reading this article, you should be able to use the scripts to retrieve and display images from your SQL Server database. Once you try this technique, you'll wonder how you ever got along without it; it's more efficient and easier to manage than getting the images from the hard drive. You can easily modify the script in Listing 2 to iterate through a database and display the images in rows, such as for a shopping cart application. The really nice thing about the System.Drawing namespace used to display these images is that it scales to the size parameters set for the image, without skewing or dithering the image in any way. You no longer need to use a professional graphics program to scale and make a separate thumbnail for each image. This is worth its weight in gold alone, and another good reason to handle database images with C#.