delphi 从access数据库中读取图片
读取代码如下:procedureTForm1.Button1Click(Sender:TObject);VarMyJPEG:TJPEGImage;MS:TMemorySt...
读取代码如下:
procedure TForm1.Button1Click(Sender: TObject);
Var
MyJPEG : TJPEGImage;
MS : TMemoryStream;
Begin
Try
MS := TMemoryStream.Create;
TBlobField(Query1.FieldByName('Image')).SaveToStream(MS);
MS.Position := 0;
MyJPEG := TJPEGImage.Create;
MyJPEG.LoadFromStream(MS);
DBImage1.Picture.Bitmap.Assign(MyJPEG);
Finally
MS.Free;
MyJPEG.Free;
End;
End;
数据库中一共保存了10幅图片,如果按了button按钮之后,随机读取并显示一幅图片,如何定位??谢谢! 展开
procedure TForm1.Button1Click(Sender: TObject);
Var
MyJPEG : TJPEGImage;
MS : TMemoryStream;
Begin
Try
MS := TMemoryStream.Create;
TBlobField(Query1.FieldByName('Image')).SaveToStream(MS);
MS.Position := 0;
MyJPEG := TJPEGImage.Create;
MyJPEG.LoadFromStream(MS);
DBImage1.Picture.Bitmap.Assign(MyJPEG);
Finally
MS.Free;
MyJPEG.Free;
End;
End;
数据库中一共保存了10幅图片,如果按了button按钮之后,随机读取并显示一幅图片,如何定位??谢谢! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询