CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 ASP display image data from Mysql database

Print topic Send  topic

Author Message
Mark1
Posted: 01/07/2006, 4:30 PM

Hi,

Does anyone here have the code for CCS to display image data from Mysql database in ASP.

Is there a beforeShow event I could add? I have an existing DB with lots of images stored in an MySql and need to be able to display the images.

Thanks
Mark1
Posted: 01/09/2006, 1:22 AM

Thanks anyway - I got this working
DonB
Posted: 01/10/2006, 9:12 AM

Please don't keep it a secret.

--
DonB

http://www.gotodon.com/ccbth


"Mark1" <Mark1@forum.codecharge> wrote in message
news:643c22b3a641d0@news.codecharge.com...
> Thanks anyway - I got this working
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Marcus


Posts: 49
Posted: 01/12/2006, 10:00 AM

Now that you have figured it out how about sharing it here so that others can use the solution too.
View profile  Send private message
EMG


Posts: 35
Posted: 01/12/2006, 10:24 AM

1. Create a seperate "GetImage" page with no gui and add a Page_AfterInitialize event. Query the database for the binary image using a passed record id and Response.write (or binary write) the result.

2. From page where you are displaying the image, add an image tag with the source set to the relative URL of the GetImage page: <img src="GetImage.asp?Id=44">. Include the record id in the select statement and just add the curly bracket place holder.

I've done this with asp, .net, and php.
View profile  Send private message
Walter Kempees
Posted: 01/12/2006, 11:09 AM

So did I, easy and quick solution.

"EMG" <EMG@forum.codecharge> schreef in bericht
news:643c69ecd4e5e1@news.codecharge.com...
> 1. Create a seperate "GetImage" page with no gui and add a
> Page_AfterInitialize
> event. Query the database for the binary image using a passed record id
> and
> Response.write (or binary write) the result.
>
> 2. From page where you are displaying the image, add an image tag with the
> source set to the relative URL of the GetImage page: <img
> src="GetImage.asp?Id=44">. Include the record id in the select statement
> and
> just add the curly bracket place holder.
>
> I've done this with asp, .net, and php.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Mark1
Posted: 01/13/2006, 12:30 PM

Hi,
All I did was change the link in the HTML to point to a script I found on the net.

I used the link to point to the ID with the following code:

Dim UserPhotoID  
UserPhotoID = Request.QueryString("UserPhotoID")  
  
     strConnect = "SERVER=***;DRIVER={MySQL ODBC 3.51 Driver};DATABASE=***;UID=***;pwd=***;"  
  
     ' Create ADO Connection  
     Set Conn = Server.CreateObject("ADODB.Connection")  
     Conn.Open strConnect  
  
     ' Create Recordset  
     Set RecSet = Server.CreateObject("ADODB.Recordset")  
     RecSet.Open "select Image from userphoto where UserPhotoID =" & Request("UserPhotoID"), Conn, 2, 3  
       
     'If Not RecSet.EOF Then  
     if not (RecSet.eof and RecSet.bof) Then  
  
     Response.ContentType = "image/jpeg"       
     Response.BinaryWrite(RecSet("Image"))  
     End If  
  
     RecSet.Close  
     Set RecSet = Nothing  
  
     Conn.Close  
     Set Conn = Nothing  

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.