Retrieving and Showing an Image from a Database

In this example, the image is created from the Image field in the Images table from the Northwind database on-the-fly and once again is never saved to hard disk. Then, the image is displayed using the Image server control. We will use one Web Form to create and implement an image, and another to display it. Listing 13.6 contains the image Web Form, which will retrieve the image from the database and create a Web-usable image.

Listing 13.6. Web Form Used to Create the Image from a Database for Web Use
 [VisualBasic.NET] 01: <%@ OutputCache Duration="30" VaryByParam="ImageID" %> 02: <%@ Import Namespace="System.Data" %> 03: <%@ Import Namespace="System.Data.SqlClient" %> 04: 05: <script language="vb" ...

Get Programming Data-Driven Web Applications with ASP.NET now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.