I am using Delphi Xe2 with update 4 and latest version of LiteDAC trial.
I am using code directly from demo and trying to save image to a Blob field in my database.
The code appears to work until I either try to move off the record or use the post command then I get a "Cannot convert type' error.
When using LiteDAC (and a SQLite db that I have created using other tools) I can view images in the database, save them to file, clear them, etc. but just can't load images into the Blob field using LiteDAC.
Below is the code from the demo the only thing different is that in my database the field is named 'image' instead of 'Picture' (my code has been appropriately changed).
Code: Select all
procedure TPicturesFrame.btLoadClick(Sender: TObject);
var
BlobField: TBlobField;
FileName: string;
begin
if OpenPictureDialog.Execute then begin
if quPictures.State in [dsBrowse] then
quPictures.Edit;
BlobField := quPictures.FieldByName('Picture') as TBlobField;
FileName := OpenPictureDialog.FileName;
BlobField.LoadFromFile(FileName);
end;
end;
If the missing files were included in the demo I probably wouldn't be stuck here bugging you for your assistance.