加OpenPictureDialog1控件
if OpenPictureDialog1.execute then
begin
tablename.edit;
tablefieldname.LoadFromFile(OpenPictureDialog1.filename);
tablename.post;
end;
tablename table控件
tablefieldname 图象字段
onclick时加入:
begin
if opendialog1.execute then
begin
table1.edit;
Tblobfield(table1.fieldbyname(dbimage1.datafield)).loadfromfile(opendialog1.filename);
table1.post;
end;
dbimage1.loadpicture;
end;
var
filestream:TFilestream;
begin
if opendialog1.execute then
begin
table1.edit;
try
fileStream.create(opendialog1.filename,openread);
TBlobField(table1.fieldbyname(imageFieldName))
.loadFromStream(FileStream);
table1.post
finally
filestream.free;
end;