如何向SQLServer中保存bmp图象以及读取
插入修改 保存图象
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;
补充:软件开发 , Delphi ,