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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.