我用的是PARADOX的数据库。表的一个字段类型是图片。
插入图片时用
table1.insertrecord(edit1.text,image1.picture)
编译通过了, 运行时图片是a.bmp类型,
出现了错误"LIST INDEX OUT OF BOUNDS",请求各位高手的指
插入图片时用
table1.insertrecord(edit1.text,image1.picture)
编译通过了, 运行时图片是a.bmp类型,
出现了错误"LIST INDEX OUT OF BOUNDS",请求各位高手的指
sFileName:string;
function BlobConentToString(const FileName:String):String;
begin
with TFileStream.create(FileName,fmOpenRead)do
try
SetLength(Result,Size);
Read(Pointer(Result)^,Size);
finally
Free;
end;
end;
begin
if (Opendialog1.execute) then
begin
sFileName:=OpenDialog1.FileName;
adotable1.edit;
adotable1.fieldbyname('blobs').asstring:= blobcontenttoString(sFileName);
AdoTable1.post;
end;
end;