8
82625741
Unregistered / Unconfirmed
GUEST, unregistred user!
请问各位大侠,我在使用中层读取SQL中的图片信息时遇到如下错误:
unable to find record . no key specified.
record changed by another user.
读取信息的代码如下:
var
mem:tmemorystream;
pjpg:tjpegimage;
begin
with clientdataset3 do
if not FieldByName('picture').IsNull then
begin
mem := TMemoryStream.Create;
pJpg := TJPEGImage.Create;
try
TBlobField(FieldByName('picture')).SaveToStream(mem);
mem.position:=0;
pJpg.LoadFromStream(mem);
Image1.Picture.Assign(pJpg);
finally
mem.Free;
pJpg.Free;
end;
end else image1.Picture.Assign(nil);
end;
为什么每次执行到: TBlobField(FieldByName('picture')).SaveToStream(mem);时就会
发生上述错误,我在写入图片时是用流的方式,但是直接用TTable和TQuery时不会有任何
错误,系统使用:Delphi 5.0+Sql 7.0+Win2000
unable to find record . no key specified.
record changed by another user.
读取信息的代码如下:
var
mem:tmemorystream;
pjpg:tjpegimage;
begin
with clientdataset3 do
if not FieldByName('picture').IsNull then
begin
mem := TMemoryStream.Create;
pJpg := TJPEGImage.Create;
try
TBlobField(FieldByName('picture')).SaveToStream(mem);
mem.position:=0;
pJpg.LoadFromStream(mem);
Image1.Picture.Assign(pJpg);
finally
mem.Free;
pJpg.Free;
end;
end else image1.Picture.Assign(nil);
end;
为什么每次执行到: TBlobField(FieldByName('picture')).SaveToStream(mem);时就会
发生上述错误,我在写入图片时是用流的方式,但是直接用TTable和TQuery时不会有任何
错误,系统使用:Delphi 5.0+Sql 7.0+Win2000