mhanefitel
asked on
Loading Blob field from database to PDF using stream.
Hi,
I have a blob field in MS SQL 2005 database. In that field i store pdf files. I want these PDF files to be viewed by the users. When i load these files from database 0 DO NOT WANT TO SAVE THEM to disk and then viewed. I want these files to be viewed by the users directly from the database without saving to disk.(Using steams will work for me)
I want working examples that shows me how to accomplish this.
I use BDS 2006, Win XP and SDAC Component to access SQL Server 2005.
Thans in advance...
I have a blob field in MS SQL 2005 database. In that field i store pdf files. I want these PDF files to be viewed by the users. When i load these files from database 0 DO NOT WANT TO SAVE THEM to disk and then viewed. I want these files to be viewed by the users directly from the database without saving to disk.(Using steams will work for me)
I want working examples that shows me how to accomplish this.
I use BDS 2006, Win XP and SDAC Component to access SQL Server 2005.
Thans in advance...
ASKER
You are using TJpegImage component but there is no any pdf component in delphi like TJpegImage. I need to use olecontainer to do this but 1 do not know how to do this
Thanks in advance...
Thanks in advance...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Forced accept.
Computer101
EE Admin
Computer101
EE Admin
The Example below Show how to load a BLOB (Picture) from Oracle database to a Delphi form
It may help you ....
procedure TfrmMain.vtTreeFocusChange
Node: PVirtualNode; Column: TColumnIndex);
var NodeData: ptrStdNode;
bS : TADOBlobStream;
Pic : TJpegImage;
v_PicsPath: String;
begin
try
NodeData:= Sender.GetNodeData(Node);
frmMain.Image1.Visible:= True;
dmfConn.qrImage.Close;
dmfConn.qrImage.SQL.Clear;
dmfConn.qrImage.SQL.Add(
'SELECT STUDNUM, STUDIMAGE ' + #13 +
'FROM k_StdImages ' + #13 +
'WHERE STUDNUM = :StdNum ');
dmfConn.qrImage.Parameters
dmfConn.qrImage.Open;
if(dmfConn.qrImage.RecordC
begin
v_PicsPath:= Copy(ParamStr(0), 1, Length(ParamStr(0)) - 13) + 'Pics\';
frmMain.Image1.Picture.Loa
end
else
begin
bS := TADOBlobStream.Create(TBlo
try
bS.Seek(JpegStartsInBlob(T
Pic:=TJpegImage.Create;
try
Pic.LoadFromStream(bS);
frmMain.Image1.Picture.Gra
finally
Pic.Free;
end;
finally
bS.Free
end;
end;
except
end;
end;
Regards,
Khalid.