Board index » delphi » DataBase help needed

DataBase help needed

Hi

I'm trying to make a database program to store images with some additional
data.
How to force Delphi to insert new data from a multi-select-enable
opendialog?
I mean. When the opendialog appears I select several files and they are
automaticly inserted into the database.
The picture are jpg format

Thanks for help in advance

Nikodem Tomczak

 

Re:DataBase help needed


Try:

procedure TForm1.Button1Click(Sender: TObject);
var
  i: Integer;
  F: TStream;
begin
  if OpenDialog1.Execute then
  begin
    for i := 0 to OpenDialog1.Files.Count - 1 do
    begin
      F := TFileStream.Create(OpenDialog1.Files[i], fmOpenRead);
      try
        Table1.Edit;
        try
          TBlobField(Table1.FieldByName('Picture')).LoadFromStream(F);
          Table1.Post;
        except
          Table1.Cancel;
        end;
      finally
        F.Free;
      end;
    end;
  end;
end;

"Nikodem Tomczak" <tomc...@ct.utwente.nl> schreef in bericht
news:Pine.WNT.4.21.0102071340410.-499437@karssenberg...

Quote
> Hi

> I'm trying to make a database program to store images with some additional
> data.
> How to force Delphi to insert new data from a multi-select-enable
> opendialog?
> I mean. When the opendialog appears I select several files and they are
> automaticly inserted into the database.
> The picture are jpg format

> Thanks for help in advance

> Nikodem Tomczak

Other Threads