ASP file with database connection problem

Reply

Join Date: Oct 2006
Posts: 5
Reputation: chris3000 is an unknown quantity at this point 
Solved Threads: 0
chris3000 chris3000 is offline Offline
Newbie Poster

ASP file with database connection problem

 
0
  #1
Oct 27th, 2006
Hi

I would expect to see an image from the database with that code:


<%
set conn=server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.jet.OLEDB.4.0"
conn.Open "F:/projet/test1.mdb"

set rs= conn.Execute("SELECT photo FROM photos where ID=1")

Response.ContentType="image/jpg"
Response.BinaryWrite(rs("photo"))

conn.Close
%>

or

with dsn(data source name) link in contral panel
<%

Set conn = Server.CreateObject("ADODB.Connection")
conn.open "WinConnection"

set rs= conn.Execute("SELECT photo FROM photos where ID=1")

Response.ContentType="image/jpg"
Response.BinaryWrite(rs("photo"))

conn.Close
%>

The only thing I get is a tons of ascii code
Anyone can help me on this ?

I get another problem

When Im doing a refresh 3 or 4 times on that asp page there is a messagebox with prompts as follows:
==================================
Title: File Download - Security Warning
Name: Setup.exe
From: localhost

Buttons: [Run] [Save] [Cancel]

While files from internet can be useful, this file type can potentially harm your computer. If you do not trust the source, do not run or save this software. (link: ) What's the risk?
================================


When i copy paste the code in a new asp file
it works like 3 or 4 times (doing some refresh) and then the messagebox come back

I tried to change security level for intranet too, but i don't know which parameter to change.

I tried with Firefox and Opera and the same problem happens.

thanx
Chris
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ASP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC