【发布时间】:2014-10-13 13:33:58
【问题描述】:
我正在尝试将位图图像保存到数据库中
Bitmap map = new Bitmap(pictureBoxMetroMap.Size.Width, pictureBoxMetroMap.Size.Height);
我在数据库中创建了一个数据类型为binary 的列imgcontent,但我的问题是如何将此bitmap(映射)转换为二进制数据?
我如何从数据库中检索数据?
我用谷歌搜索了它,我发现了类似的东西,但它不起作用:
byte[] arr;
ImageConverter converter = new ImageConverter();
arr = (byte[])converter.ConvertTo(map, typeof(byte[]));
【问题讨论】:
-
@JensB 谢谢你,但你没有使用 EF!!我说的对吗?
标签: c# entity-framework bitmap binary