Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 28 Mar 2024, 22:08

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 14 Jul 2022, 09:28 
Offline

Joined: 14 Jul 2022, 08:46
Posts: 22
Hi

Ho to save DBImageEh in MS SQL database using code(delphi) without using DataSource properties

Best Regards


Top
 Profile  
 
PostPosted: 22 Aug 2022, 08:16 
Offline

Joined: 09 Aug 2016, 02:30
Posts: 7
ituneksa wrote:
Hi

Ho to save DBImageEh in MS SQL database using code(delphi) without using DataSource properties

Best Regards


{TO SAVE}
var
MS: TMemoryStream;
begin
if Assigned(Imagem.Picture.Graphic) then
begin
MS := TMemoryStream.Create;
try
Imagem.Picture.Graphic.SaveToStream(MS);
TBlobField(TbCadastro.FieldByName('CLI_IMAGEM')).LoadFromStream(MS);
finally
MS.Free;
end;
end
else if TbCadastro.State = dsEdit then
TbCadastro.FieldByName('CLI_IMAGEM').Value := Null;
TbCadastro.Post;
end;

{TO LOAD}
var
MS: TMemoryStream;
Wic: TWICImage;
begin
if TbCadastro.FieldByName('CLI_IMAGEM').Value = Null then
Imagem.Picture.Graphic := nil
else
begin
MS := TMemoryStream.Create;
try
TBlobField(TbCadastro.FieldByName('CLI_IMAGEM')).SaveToStream(MS);
Wic := TWICImage.Create;
try
Wic.LoadFromStream(MS);
Imagem.Picture.Assign(Wic);
finally
Wic.Free;
end;
finally
MS.Free;
end;
end;
end;


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group