为什么这段代码不起作用:
使用此代码保存图像就可以了(我也在报告中看到了图像):
gallery.append;
gallery.FieldByName('Image').Assign(pic.Picture.Bitmap);
gallery.post;
但是这段代码:
Gallery.Insert;
S := CreateBlobStream(gallery.FieldByName('Image'), bmWrite);
Image1.Picture.Bitmap.SaveToStream(S);
gallery.Post;
S.Free;
导致错误“数据集未处于编辑或插入模式”。所以我用了第一个。
但将其恢复为 Timage 中的形式会导致“位图格式无效”
var S : TStream ;
s := gallery.CreateBlobStream(gallery.FieldByName('Image'), bmRead);
Pic.Picture.Bitmap.LoadFromStream(S);
s.Free;
错误显示在任何图像上。我也使用 About.com 的教程尝试了 DBimage 并不断出错。数据库是 Access 2010,图像字段是 OLE (blob)。有点卡住了。
s