|
The following code is to add photos to the corresponding fields in the database, but what's the matter, it always fails to increase?
There is no error when running, but open the database to see the corresponding field, and there is nothing? Is blank,
what is going on?
//The premise is that query4 has been opened!
if image1.Picture.Graphic = nil then
begin
if messageDlg('The photo has not been modified, do you want to update the photo, press Yes, otherwise No!', mtConfirmation, [mbYes, mbNo], 0,) = mrYes then
begin
if OpenPictureDialog1.Execute then
try
JpgPic:=TJpegImage.Create;
tempStream:=TMemoryStream.Create;
tempStream.Clear;
JpgPic.LoadFromFile(OpenPictureDialog1.FileName);
Image1.Picture.bitmap.assign(JpgPic);
JpgPic.SaveToStream(tempStream);
query4.Edit;
TBlobField(query4.FieldByName('s_picture')).LoadFromStream(tempStream);
finally
JpgPic.Free;
tempStream.Free;
end;
end;
end; |
|