Downloading Files stored in SQL Server

Downloading Files stored in SQL Server

am 10.02.2005 18:51:02 von fibreiv

I am trying to download files from my database that I uploaded to it. I can
download bmp, txt file but have not been able to d/l pdf files. I am able to
d/l pdf files stored in the file system but not in the database. Any help
would be great. Here is my code, I have hard coded the file to download for
testing purposes.

Connect = "Provider=SQLOLEDB.1;Persist Security Info=False;User
ID=sa;Password=;Initial Catalog=INNB;Data Source=pompom"

Set db = Server.CreateObject("ADODB.Connection")
db.Open Connect

SQL = "SELECT filesize, contenttype, filename, filedata FROM thefiles where
id = 2"
Set rs = db.Execute( SQL )
If rs.EOF Then Response.End
Response.ContentType = "application/pdf"
Response.AddHeader "Content-Disposition", "attachment;filename=agencies.pdf"
Response.AddHeader "Content-Length", "16863"
Response.BinaryWrite rs("filedata")



Thanks,
Brett Bishop
MCSE, MCP+I
US Bankruptcy Court