home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_06.cab / samp7d7m.asp < prev    next >
Text File  |  1997-10-15  |  3KB  |  44 lines

  1.  <% If Request("DontFrame")<>1 Then Response.Redirect "/iissamples/sdk/asp/docs/SampFram.asp?ovfile=/iishelp/iis/htm/sdk/samp7d7m.asp&srcfile=Database/Blob" %>
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
  3. <HTML>
  4. <HEAD>
  5. <META HTTP-EQUIV="Content-Type" Content="text-html; charset=Windows-1252">
  6. <title>ADO BLOB</title>
  7. <script language="JavaScript">
  8.  
  9.     szNavVersion = navigator.appVersion
  10.  
  11.     if (navigator.appName == "Microsoft Internet Explorer") {
  12.     if (szNavVersion.indexOf ("4.") >= 0) {
  13.         document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/spidie4.css">');
  14.     } else {
  15.         document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/spidie3.css">');
  16.     }
  17.     }
  18.     else if (navigator.appName == "Netscape") {
  19.     document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/spidie4.css">');
  20.     }
  21.     else {
  22.     document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/spidie3.css">');
  23.     }
  24.  
  25. </script>
  26. <META NAME="DESCRIPTION" CONTENT="Internet Information Server reference information"></HEAD>
  27. <BODY BGCOLOR=#FFFFFF TEXT=#000000>
  28. <font face="Verdana, Arial, Helvetica">
  29. <h3><a name="_ado_blob"></a>ADO BLOB</h3>
  30. <p>
  31. Text isn't the only kind of information that can be stored in databases, so of course it's not the only kind of data that ASP and ADO can handle. Binary large objects, or BLOBs, representing anything from new chemical products to graphical images, can be retrieved and stored using many of the same methods and properties used to work with text-based data. </p>
  32. <p>
  33. This example accesses a database, pulls out a company logo, and sends it to the client browser. Before any database access or manipulation occurs, however, the script must tell the client browser what kind of content to expect, so the <b>ContentType</b> property of the <b>Response</b> object is set to image/gif. This indicates that the client browser should treat the incoming information as binary data to be displayed as an image, instead of an audio file or a plain text file, for example. </p>
  34. <p>
  35. <b>CreateObject</b> is used, just like any other database access using ADO, to create a <b>Connection</b> object, which is then used to open an ODBC connection with the SQL IISSDK database. A new <b>Recordset</b> object is instantiated and populated with the results of the SQL query execution.</p>
  36. <p>
  37. The contents of the Logo field, a binary image created in the GIF format, are copied to the <i>Pic</i> variable, using the <b>ActualSize</b> property to ascertain the true length of the image, and the <b>GetChunk</b> method to specify how much of the image to copy. The <b>Response.BinaryWrite</b> method is then invoked to write the binary image to the buffer. <b>Response.End</b> flushes the buffer and sends the HTTP headers, including the image/gif content-type specifier and the entire binary image, to the client browser. </p>
  38. <p>
  39. <b>Note</b>  SQL Server must be installed, and configured properly, on the same machine on which IIS is running in order for this sample to work correctly. In addition, the IISSDK data source must also be configured properly.</p>
  40. <hr class="iis" size="1">
  41. <p align="center"><em><a href="/iishelp/common/colegal.htm">© 1997 by Microsoft Corporation. All rights reserved.</a></em></p>
  42. </BODY>
  43. </HTML>
  44.