EhLib.Com https://forum.ehlib.com/en/ |
|
Ho to save DBImageEh in ms sql using code https://forum.ehlib.com/en/viewtopic.php?f=5&t=1160 |
Page 1 of 1 |
Author: | ituneksa [ 14 Jul 2022, 09:28 ] |
Post subject: | Ho to save DBImageEh in ms sql using code |
Hi Ho to save DBImageEh in MS SQL database using code(delphi) without using DataSource properties Best Regards |
Author: | adriano.quintino [ 22 Aug 2022, 08:16 ] |
Post subject: | Re: Ho to save DBImageEh in ms sql using code |
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; |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |