473,386 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Show image from SQL Image Field ?

Bob
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
Jul 19 '05 #1
2 8452
Well that's a nice rendition of ASCII of a binary file. Use
Response.BinaryWrite

--
George Hester
__________________________________
"Bob" <No********@adelphia.net> wrote in message
news:uM*************@TK2MSFTNGP10.phx.gbl...
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

Jul 19 '05 #2
Bob
I use Response.binarywrite and I get this:

http://website.bestsytes.net/untitled.asp
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
6
by: Steve Speirs | last post by:
Hi I'm trying to show/hide a simple piece of text and a text field on a form based on what choice is made from a drop down box. <select name="dropdown" size="1"> <option selected...
2
by: J Sahoo | last post by:
Hi, I have a browse page where I am showing few fields from my SQL Server table. One of the field is Image type, all the fields are bound to a single table. I want to show the image from the...
5
by: Sukhanov Volodya | last post by:
Hello, all! Does anybody knows, how I can show an image field SQL Server using VB. NET ? I have an database, which has an table with an field which has type 'image' (the type of field) I want...
3
by: chrisse_2 | last post by:
Hey, In my database i have images, linked to the database, corresponding to different records. I am having trouble making them show in the report. At the moment i can only get the one picture to...
3
by: | last post by:
I'm using the DataList and GridView controls, and I am trying to wrap my head around the problem of conditionally showing or hiding cells/cell content based on the presence or absence of DB data. I...
2
by: aris1234 | last post by:
Can you use PHP to show a default image if the image field in a database row is empty? I'm creating a news page, but the client may not always upload an image with a news story. I know how to hide...
12
by: lawrence k | last post by:
I've a form that starts off like this: <form method="post" action="profile.php? id=5&formName=my_story_edit.htm" enctype="multipart/form-data"> <p>Email address:<br /> <input type="text"...
5
by: canajien | last post by:
I am trying to get a script to show a particular image when a field value = 1, otherwise it will show something else, and this is what I came up with: $i=0; while ($i < $num) { ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.