【发布时间】:2010-12-12 14:07:09
【问题描述】:
我正在使用 C#、.NET Compact Framework 2.0 SP2 和 SqlServer CE 3.1 为 Windows Mobile 6.0 开发 WinForm 应用程序。
我有这段代码不工作:
using (SqlCeDataReader reader = cmd.ExecuteReader())
{
if (reader.Read())
{
//read the signature from the database
long imgSize = reader.GetBytes(0, 0, null, 0, 0);
image= new byte[imgSize];
reader.GetBytes(0, 0, image, 0, 0);
}
}
我认为从图像中获取包含字节的列中存储的所有数据存在问题。
当我这样做时:
bitmapImage = new Bitmap(new MemoryStream(image));
我遇到了 OutOfMemoryException。
但如果我使用 TableAdapter 来获取图像,它就可以完美地工作。
我做错了什么?
谢谢。
【问题讨论】:
标签: c# windows-mobile compact-framework image-manipulation sql-server-ce