Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access ASP
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access ASP Using ASP with Microsoft Access databases. For Access questions not specific to ASP, please use the Access forum. For more ASP forums, please see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access ASP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 13th, 2004, 04:33 PM
Registered User
 
Join Date: May 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ado Image problem

Hi, EveryBody,

I want to display pictures stored in a database. First I use the following code(VB6) to save the picture to the database:

Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim stream As New ADODB.stream
Set cnn = New Connection


cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=H:\test.mdb;"
cnn.CursorLocation = adUseClient
cnn.Open
Set rst = New Recordset
rst.ActiveConnection = cnn
rst.Open "t1", cnn, adOpenKeyset, adLockOptimistic
rst.AddNew
rst!p_name = "dd"
stream.Type = adTypeBinary
stream.Open
stream.LoadFromFile "H:\pp.jpg"
rst!pic = stream.Read
Set stream = Nothing
rst.Update
cnn.Close
------------------------------
and then I use the following code(ASP) to display the image:

<%
Dim cnn
Dim rs
' Clear existing HTTP header info
Response.Expires = 0
Response.Buffer = TRUE
Response.Clear

' Set the HTTP header to an image type.
Response.ContentType = "image/JPEG"

cnnPubs=getdbconn() ' the function return the db connection
set rs=server.CreateObject("adodb.recordset")
rs.Open "SELECT FROM t1where id=1",cnn

Response.BinaryWrite rst("pic")
Response.End
%>

and I use <img SRC="getImage.asp"> to show the image.
the first(vb) code works well.
but I alway can not display the image, I just got a image like red X.

please help me to solve the problem.

Thanks a lot!!!


Best!

Alan
Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ADO.Net Problem akhilesh_g ASP.NET 2.0 Professional 2 December 18th, 2007 05:33 AM
ADO DB problem. KalliMan2 Visual C++ 7 March 27th, 2006 02:00 AM
ADO.NET(Retrieve image from databse) lovelyphor ADO.NET 1 October 9th, 2004 10:17 AM
ADO.NET Problem lakmaldp ADO.NET 1 July 15th, 2004 01:58 AM
ADO.NET Problem dfb78 Classic ASP Databases 1 June 5th, 2003 05:01 PM



All times are GMT -4. The time now is 06:53 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.