Reviewing my code. Displaying a BLOB image through a browser



I need to display a blob image from a database through my web browser
and I am struggling big. Below you will see the error message I'm
getting as well as my code for ASP and my HTML code. Any advice is
greatly appreciated. Thanks


This is the error I get when I try to open my asp page. When I try to
open the HTML page that uses the ASP page as a source for my image I
get a box for an image but it has the icon for a broken image.
Technical Information (for support personnel)
· Error Type:
Server object, ASP 0177 (0x800401F3)
Invalid class string
/ben/bam3.asp, line 11
· Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR
1.1.4322)
· Page:
GET /ben/bam3.asp
· Time:
Tuesday, December 19, 2006, 11:12:49 AM
· More information:
Microsoft Support
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Below is my code. I modified some code I found at 4guysfromrolla.com
I am trying to use an ASP page to grab a binary image from a database.

My Table is called A_870211EE_7122_4AB3_B513_96B2AA58447A
The Column within the table where the images are stored is AF_Photo_1
The column where I define which employee gets their picture shown is
AF_Employee_Number
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<html>
<head>
<title>Displaying Pic from DB</title>
</head>
<body bgcolor="white" text="black">
<%
Dim iAF_Employee_Number

iAF_Employee_Number = Request.QueryString("AF_Employee_Number")

Dim objConn, objRS, strSQL
strSQL = "SELECT AF_Photo_1 FROM
A_870211EE_7122_4AB3_B513_96B2AA58447A WHERE AF_Employee_Number = " &
iAF_Employee_Number

Set objConn = Server.CreateObject("ODBC.Connection")

objConn.Open "DSN=AsureIDc51Test", "xx", "xxxxx" ß username and
password removed for security

Set objRS = Server.CreateObject("ODBC.Recordset")

objRS.Open strSQL, objConn

Response.ContentType = "image/jpeg"

Response.BinaryWrite objRS("AF_Photo_1")
%>
</body>
</html>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
This is the code for my HTML page calling to get an employee's photo
based on their id.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<html>

<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>

<body>
<img src="bam3.asp?AF_Employee_Number=301867">
</body>

</html>

.



Relevant Pages

  • Re: Frontpage-Desktop-Engine-SQL
    ... When you run ASP, you're not running under the System user, or yourself, as ... as the database file is changed by the operation. ... > I got the same error message when I try to connect to a local SQL ...
    (microsoft.public.frontpage.programming)
  • Re: Parameter passing query
    ... Definitely a bug Microsoft HTML code. ... >> I've developed a ASP page that searches a database on our web server. ... >> created a html form that passes parameters to a SQL statement on the ASP ...
    (microsoft.public.frontpage.programming)
  • Re: content static for 24hrs
    ... if data found the html page is created ... Writing each hit to a database is what springs to my mind. ... The are single purpose servers. ... Would upgrading your servers and writing standard ASP be an acceptable ...
    (microsoft.public.inetserver.asp.db)
  • Re: Another Drop List question
    ... If your database field is set to not allow zero-length strings, ... > ASP code and HTML and for me, it makes it easier to line up my quotes. ...
    (microsoft.public.inetserver.asp.general)
  • Re: Front Page 2000 Database asp file
    ... I received a message to save the form as an .asp ... >> a survey and results will be stored in the database. ... >> displaying as html. ... only the html code appeared. ...
    (microsoft.public.frontpage.programming)