2
我遇到了一个大问题。
我上传了图片,并得到byte[]
。
在数据库中我有NVARCHAR(MAX)
字段,它不能更改。
我做了什么,并保存在数据库中我以后不能将它作为图像。
我试过.ToString()不起作用。
我已经试过这样:如何在数据库的文本字段中存储byte []并检索它
private byte[] GetBytes(string str)
{
byte[] bytes = new byte[str.Length * sizeof(char)];
System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
return bytes;
}
static string GetString(byte[] bytes)
{
char[] chars = new char[bytes.Length/sizeof(char)];
System.Buffer.BlockCopy(bytes, 0, chars, 0, bytes.Length);
return new string(chars);
}
,当我尝试把它放在RadBinaryImage
我什么也没得到。
这是错误:
The provided binary data may not be valid image or may contains unknown header
您的MIME编码/解码出入TEXT字段的字节。 – hometoast 2013-02-12 14:58:23