插入修改 保存圖象
bmTemp:=TBitmap.Create;
ms:=TMemoryStream.Create;
try
qryFace.Close;
qryFace.SQL.Clear;
qryFace.SQL.Add(update video_face_image set face_image2=:face_image2);
qryFace.SQL.Add(Format(where event_id=%d,[qryPrepare.FieldByName(event_id).AsInteger]));
bmTemp.LoadFromFile(c:face2.bmp);
bmTemp.SaveToStream(ms);
qryFace.Parameters.ParamByName(face_image2).LoadFromStream(ms,ftBlob);
finally
ms.Free;
bmTemp.Free;
end;
如何在Image組件中顯示
bmTemp:=TBitmap.Create;
ms:=TMemoryStream.Create;
try
TBlobField(qryFace.FieldByName(face_image1)).SaveToStream(ms);
ms.Position:=0; //最最重要的一點
bmTemp.LoadFromStream(ms);
imgFace1.Picture.Bitmap:=bmTemp;
finally
ms.Free;
bmTemp.Free;
end;