Thread: [SOLVED] Seattle, FireDac, Access
View Single Post
  #2  
Old 03-19-2016, 11:04 PM
FreakaZoid2 FreakaZoid2 is offline
Senior Member
 
Join Date: Jul 2009
Posts: 361
Default Here is actual code...

Code:
procedure TfrmMain.Update_Details;
var
  _memStream  : TMemoryStream;
begin
  with dmMain do
  begin
    fdcmdMain.CommandText.Text := 'update myTable' + #13 +
      'set fld_01 = :fld_01,' + #13 +
      'fld_02 = :fld_02' + #13 +
      'where fld_ID = :fld_ID';
    fdcmdMain.ParamByName('fld_ID').Value := _keyID;
    fdcmdMain.ParamByName('fld_01').Value := edt1.Text;
    if Assigned(img1.Picture.Graphic) then
    begin
      _memStream := TMemoryStream.Create;
      img1.Picture.Graphic.SaveToStream(_memStream);
      _memStream.Seek(0,0);
      fdcmdMain.ParamByName('fld_02').DataType := ftBlob;
      fdcmdMain.ParamByName('fld_02').LoadFromStream(_memStream, ftBlob);
      fdcmdMain.Execute();
      _memStream.Free;
    end
    else
    begin
      fdcmdMain.ParamByName('fld_13').Value := '';
      fdcmdMain.Execute();
    end;
  end;
end;