paragvshah
Programmer
Hi All,
I want to display an image stored in as "Image" Datatype in SQL. I am able to Insert the data in the table but while retreiving, it display the junk data.
I am pasting the code. Can any one help me out at what place i am wrong?
------------------------------------------
<%
Response.Buffer = True
Dim ID
ID = Request("ID"
If Len(ID) < 1 Then
ID = 7
End If
Dim rs
Set rs = Server.CreateObject("ADODB.Recordset"
rs.Open "select [ImageContent], [ContentType] from PDAImages where ImageID = " & ID, cn, 2, 4
If Not rs.EOF Then
Response.ContentType = rs("ContentType"
BlockSize = 4096
Set Field = rs("ImageContent"
FileLength = Field.ActualSize
NumBlocks = FileLength \ BlockSize
LeftOver = FileLength Mod BlockSize
Response.BinaryWrite Field.GetChunk(LeftOver)
For intLoop = 1 To NumBlocks
Response.BinaryWrite Field.GetChunk(BlockSize)
Next
End If
rs.Close
Set rs = Nothing %>
----------------------------------------------
Please help me out
Thanks
Parag
I want to display an image stored in as "Image" Datatype in SQL. I am able to Insert the data in the table but while retreiving, it display the junk data.
I am pasting the code. Can any one help me out at what place i am wrong?
------------------------------------------
<%
Response.Buffer = True
Dim ID
ID = Request("ID"

If Len(ID) < 1 Then
ID = 7
End If
Dim rs
Set rs = Server.CreateObject("ADODB.Recordset"

rs.Open "select [ImageContent], [ContentType] from PDAImages where ImageID = " & ID, cn, 2, 4
If Not rs.EOF Then
Response.ContentType = rs("ContentType"

BlockSize = 4096
Set Field = rs("ImageContent"

FileLength = Field.ActualSize
NumBlocks = FileLength \ BlockSize
LeftOver = FileLength Mod BlockSize
Response.BinaryWrite Field.GetChunk(LeftOver)
For intLoop = 1 To NumBlocks
Response.BinaryWrite Field.GetChunk(BlockSize)
Next
End If
rs.Close
Set rs = Nothing %>
----------------------------------------------
Please help me out
Thanks
Parag