// save the image to a database function imagesavetosql (dataset: TQuery; filename: String): boolean; var imagejpg: TJPEGImage; // jpg picture MyStm: TMemoryStream; begin result: = false; MyStm: = TMemoryStream.Create; imagejpg: = Tjpegimage .Create; if filename <> '' then begin imagejpg.LoadFromFile (filename); MyStm.Position; (MyStm) imagejpg.SaveToStream: = 0; TBlobField (dataset.FieldByName ( '. pict')) LoadFromStream (MyStm); / / Do not be with DMImage, because it only supports BMP Result: = true; end; mystm.free; imagejpg.free; end; // Add TDIRECTORISTBOX, TGAGE Control Procedure TFRMPICT.BITBTN2CLICK (Sender: TOBJECT); VAR dirlist: TStringList; i: Integer; begin inherited; if chk_road.Checked then begin dirlist: = TStringList.Create; dirlist.Clear; try GetAllFileName (DirectoryListBox1.Directory, dirlist); if dirlist.Count> 0 then begin Gauge1.MinValue: = 0; gauge1.maxvalue: = dirlist.count-1; for i: = 0 to dirlist.count-1 do begin with dm.qry_pict do begin insert; Fields [0] .sstring: = COPY (Dirlist.strings [i], 1, POS ('.', dirlist.strings [i]) - 1); if iMageSavetosql (DM.QRY_PICT, DIRLIST.STRINGS [I]) = false the begin showmessage (' Import ' Dirlist.Strings [i] '. Error when JPG images '); abort; end; post; end; // with gauge1.addprogress (1); end; // for end // if else showmessage (' There is no JPG type picture ') in this directory; Finally Dirlist.free; end; Else ShowMessage (' Please perform the path selection operation '); // close;