FILE: SHOWIMG.ASP
<%@ LANGUAGE="VBSCRIPT" %>
<%
' Clear out the existing HTTP header information
Response.Expires = 0
Response.Buffer = TRUE
Response.Clear
' Change the HTTP header to reflect that an image is being passed.
Response.ContentType = "image/gif"
Set cn = Server.CreateObject("ADODB.Connection")
' The following open line assumes you have set up a System DataSource
' by the name of myDSN.
cn.Open "DSN=myDSN;UID=sa;PWD=;DATABASE=pubs"
Set rs = cn.Execute("SELECT logo FROM pub_info WHERE pub_id='0736'")
Response.BinaryWrite rs("logo")
Response.End
%>
这只是单独发送一种二进制数据。还可以把这二进制与正常文本结合起来。
<HTML>
<HEAD><TITLE>Display Image</TITLE></HEAD>
<BODY>
This page will display the image New Moon Books from a SQL Server 6.5
image field.<BR>
<IMG SRC="SHOWIMG.ASP">
</BODY>
</HTML>
其中关键在于 <IMG SRC="SHOWIMG.ASP"> ,它在主文档发送正常文本时,把二进制数据也送了出去。