Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Show image from SQL Image Field ?

Reply
Thread Tools

Show image from SQL Image Field ?

 
 
Bob
Guest
Posts: n/a
 
      08-22-2003
Hello:

I've tried showing an image field from an MS SQL Server 2000 image field on
an ASP page but All I get is this
http://http://new.confectioneryhouse...free/about.asp

I added the content type and followed the many postings but no joy.

Here is my code. I'm using 2 pages.

(Page 1) blob.asp

<%
set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_blob_STRING
Recordset1.Source = "SELECT AboutPic FROM Elizabeth.GF_AboutUs"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
Response.contentType = "image/jpg" 'Recordset1.Fields("AboutPic") <---Tried
both methods
size = Recordset1.Fields("AboutPic").ActualSize
blob = Recordset1.Fields("AboutPic").GetChunk(size)
Response.binarywrite(blob)
%>

(Page 2 Show the Image)

<%
Dim urlString
urlString = "?" & Request.QueryString
%>

<% Another rs to show other information as text from the same table %>

<body>
<img src="blob.asp<%=urlString%>" width="194" height="256">
</body>



TIA

Bob


 
Reply With Quote
 
 
 
 
George Hester
Guest
Posts: n/a
 
      08-22-2003
Well that's a nice rendition of ASCII of a binary file. Use
Response.BinaryWrite

--
George Hester
__________________________________
"Bob" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello:
>
> I've tried showing an image field from an MS SQL Server 2000 image field

on
> an ASP page but All I get is this
> http://http://new.confectioneryhouse...free/about.asp
>
> I added the content type and followed the many postings but no joy.
>
> Here is my code. I'm using 2 pages.
>
> (Page 1) blob.asp
>
> <%
> set Recordset1 = Server.CreateObject("ADODB.Recordset")
> Recordset1.ActiveConnection = MM_blob_STRING
> Recordset1.Source = "SELECT AboutPic FROM Elizabeth.GF_AboutUs"
> Recordset1.CursorType = 0
> Recordset1.CursorLocation = 2
> Recordset1.LockType = 3
> Recordset1.Open()
> Recordset1_numRows = 0
> %>
> <%
> Response.contentType = "image/jpg" 'Recordset1.Fields("AboutPic")

<---Tried
> both methods
> size = Recordset1.Fields("AboutPic").ActualSize
> blob = Recordset1.Fields("AboutPic").GetChunk(size)
> Response.binarywrite(blob)
> %>
>
> (Page 2 Show the Image)
>
> <%
> Dim urlString
> urlString = "?" & Request.QueryString
> %>
>
> <% Another rs to show other information as text from the same table %>
>
> <body>
> <img src="blob.asp<%=urlString%>" width="194" height="256">
> </body>
>
>
>
> TIA
>
> Bob
>
>



 
Reply With Quote
 
 
 
 
Bob
Guest
Posts: n/a
 
      08-22-2003
I use Response.binarywrite and I get this:

http://website.bestsytes.net/untitled.asp


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript validation for a not required field, field is onlyrequired if another field has a value jr Javascript 3 07-08-2010 10:33 AM
how to show an Image field from a SQL Server table field to a aspx page J Sahoo ASP .Net 3 04-30-2009 08:30 PM
1.Enter space bar for field names and save the field.The field shoud not get saved and an alert should be there as"Space bars are not allowed" Sound Javascript 2 09-28-2006 02:43 PM
How to resize an image from SQL IMAGE field =?Utf-8?B?Um9ic29uIENhcnZhbGhvIE1hY2hhZG8=?= ASP .Net 2 09-10-2004 08:47 PM
how to choose one field and automatically show sub-selections in another field? NotGiven Javascript 6 09-05-2004 04:14 AM



Advertisments