M
mike_chan
Unregistered / Unconfirmed
GUEST, unregistred user!
请大家帮忙看看,我的blob图片数据作为insert sql语句中的传递参数,发现可以运行,
但是结果数据库相应的图片字段基本是空的,查询该新增记录数据时出现"JPEG error #53"的错误。怎么解决?
procedure TForm1.Button4Click(Sender: TObject);
var
JPG:TJPEGImage;
MS:TMemoryStream;
begin
JPG:=TJPEGImage.Create;
MS:=TMemoryStream.Create;
JPG.Assign(Image1.Picture.Graphic);
JpG.SaveToStream(MS);
MS.Position :=0;
with ClientDataSet1do
begin
Close;
CommandText:='insert into 地址(照片) valuespic)';
Params.ParamByName('pic').LoadFromStream(ms,ftBlob);
Execute;
end;
MS.Free ;
jpg.Free ;
ClientDataSet1.Refresh;
end;
但是结果数据库相应的图片字段基本是空的,查询该新增记录数据时出现"JPEG error #53"的错误。怎么解决?
procedure TForm1.Button4Click(Sender: TObject);
var
JPG:TJPEGImage;
MS:TMemoryStream;
begin
JPG:=TJPEGImage.Create;
MS:=TMemoryStream.Create;
JPG.Assign(Image1.Picture.Graphic);
JpG.SaveToStream(MS);
MS.Position :=0;
with ClientDataSet1do
begin
Close;
CommandText:='insert into 地址(照片) valuespic)';
Params.ParamByName('pic').LoadFromStream(ms,ftBlob);
Execute;
end;
MS.Free ;
jpg.Free ;
ClientDataSet1.Refresh;
end;