First of all Thanks both of you.
I got the solution.Actual ly my senario was ,I had stored the pdf in SQL SEVER 2005 as varbinary(max) type and I wanted to retriew the pdf back.
Solution for this is as below :
In web we can use Response Content type as said by ssnaik .I have found the following solution.
in vb6
----------
Private Sub ByteArrayToPDFC onverter_Click( )
Dim cn As ADODB.Connectio n
Dim rs As ADODB.Recordset
Dim mstream As ADODB.Stream
Set cn = New ADODB.Connectio n
cn.Open "Provider=SQLOL EDB;data Source=test;Ini tial Catalog=test;Us er Id=_test;Passwo rd=test"
Set rs = New ADODB.Recordset
rs.Open "Select document from tbltest where id = 13", cn, adOpenKeyset, adLockOptimisti c
Set mstream = New ADODB.Stream
mstream.Type = adTypeBinary
mstream.Open
mstream.Write rs.Fields("docu ment").Value
mstream.SaveToF ile "c:\ByteTopdf.p df", adSaveCreateOve rWrite
and using Filestream
--------------------------------
bFileData = (byte[])reader["doc"];
using (FileStream stream = File.Open("C:\\ file.pdf", FileMode.Create ))
{
stream.Write(bF ileData, 0, bFileData.Lengt h);
}
-----------------
in vb.net
------------------
Private Sub SqlBlob2File(By Val DocName As String)
Dim cn As New SqlConnection(M y.Settings.DocS toreConnectionS tring.ToString( ))
Dim cmd As New SqlCommand("Sel ect DocData From Documents WHERE DocName = @DocName", cn)
Using dr As SqlDataReader = cmd.ExecuteRead er(CommandBehav ior.CloseConnec tion)
If dr.Read() Then
Dim fs As IO.FileStream = New IO.FileStream(I O.Path.Combine( Me.FolderBrowse rDialog1.Select edPath, DocName), IO.FileMode.Cre ate)
Dim b() As Byte = dr.Item("DocDat a")
fs.Write(b, 0, b.Length)
fs.Close()
End If
End Using 'dr
Comment