Is it possible to hyperlink to a blob data field in a sql db?

Majella

Member
Joined
Sep 22, 2005
Messages
5
Programming Experience
1-3
Is it possible to hyperlink to a blob data field in a sql db so that the file(doc,jpg,xls etc) open directly in the browser without the need to specify the mime type? Preferably it should open immediately by left clicking the hyperlink.



Currently I am specifying the mime type but it would be much nicer not to have to. Here's the code I'm currently using :



Dim con As New SqlConnection("Server=myServer;uid=myUID;pwd=myPWD;database=myDB")

Dim da As New SqlDataAdapter("Select * From myBlobTable", con)

Dim MyCB As SqlCommandBuilder = New SqlCommandBuilder(da)

Dim ds As New DataSet



con.Open()

da.Fill(ds, " myBlobTable")

Dim myRow As DataRow

myRow = ds.Tables("myBlobTable").Rows(e.Item.ItemIndex)



Dim MyData() As Byte

MyBlobData = myRow("BlobData")



Response.Buffer = True



'Code for jpgs

'Response.AddHeader("Content-Disposition", "attachment;filename=blob.jpg")

'Response.ContentType = "application/jpeg"



'Code for docs

Response.AddHeader("Content-Disposition", "attachment;filename=blob.doc")

Response.ContentType = "application/msword"

Response.BinaryWrite(MyBlobData)





Thanks

Majella
 
I'm thinking not, the type has to be specified somehow.... then again, it might work if the server has the mime type mapping properly set.

-tg
 
Back
Top