做一个
DataColumn
带类型
string
然后将图像的字符串二进制存储到字段中。或者,使用二进制文件本身
byte[]
.
应该100%有效。
沿着这条线的东西:
public string ImageConversion(System.Drawing.Image image)
{
if (image == null)
return string.Empty;
using (System.IO.MemoryStream memoryStream = new System.IO.MemoryStream())
{
image.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Gif);
string value = string.Empty;
for (int intCnt = 0; intCnt <= memoryStream.ToArray.Length - 1; intCnt++)
{
value = value + memoryStream.ToArray(intCnt) + ",";
}
return value;
}
}