出什么错误呀??
说出来听听
DBImage很好用的呀,你连上Datasource和Field就可以用了
你说的不好用是说不知如何导入数据吧,我给你自己写一套源码,可以使用DBImage
导入bmp,jpg文件
源码如下:
==============================
type
TPicType = (bmp, jpg);
//把图象文件导入到TDBImage控件中
procedure SaveToDBImage(APicType: TPicType; AFileName: string; ADBImage: TDBImage);
var
myJpg: TJpegImage;
begin
if (ADBImage.DataSource.State = dsEdit) or (ADBImage.DataSource.State = dsInsert) then
begin
if APicType = bmp then
begin
ADBImage.Picture.LoadFromFile(AFileName);
exit;
end;
if APicType = jpg then
begin
myJpg := TJpegImage.Create;
try
myJpg.LoadFromFile(AFileName);
ADBImage.Picture.Graphic.Assign(myJpg);
finally
myJpg.Free;
end;
end;
end;
end;
//把TDBImage控件图象导出到图象文件中
procedure LoadFromDBImage(APicType: TPicType; AFileName: string; ADBImage: TDBImage);
var
myJpg: TJpegImage;
begin
if APicType = bmp then
begin
ADBImage.Picture.SaveToFile(AFileName);
exit;
end;
if APicType = jpg then
begin
myJpg := TJpegImage.Create;
try
myJpg.Assign(ADBImage.Picture.Graphic);
myJpg.SaveToFile(AFileName);
finally
myJpg.Free;
end;
end;
end;
=================================
还不够简练,凑合着用吧