Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 03-19-2016, 10:57 PM
FreakaZoid2 FreakaZoid2 is offline
Senior Member
 
Join Date: Jul 2009
Posts: 361
Default Seattle, FireDac, Access

Access database, Table with an Ole Object field. when i try to save an image to the field it does throw an error or anything but the field is always empty. When i open the database in access it is empty. I use the code
memorystream create
image.picture.graphic.savetostream
memorystream.position := 0;
fdcmd.parambyname('myImage').LoadFromStream(memory stream, ftBlob);
execute;

no errors just no blob
Does seattle have an issue with firedac and access?
or does it have to be done differently?
  #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;
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 10:34 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.