Hi

Hi
Can you tell me someone how can i save Picture from TImage to SQL Table (SQL Field is Image) in Delphi XE 8

Comments

  1. Did you try:

    TBlobField(TSTUBasic.FieldByName('STUPhoto')).LoadFromStream(ms)

    You need to load the picture to a MemoryStream first - works for me

    ReplyDelete
  2. baeckerg That is all done in TBlobField.Assign/AssignTo - just use it - do not repeat code over and over again - we call it DRY

    This simple line of code will do everything you need

    TSTUBasic.FieldByName('STUPhoto').Assign( STUImage.Picture.Graphic );

    Internally it will copy the data into a memory stream and load this stream into the blob field.

    ReplyDelete

Post a Comment