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