Picture box to byte array

徘徊边缘 提交于 2019-12-03 16:18:00

That Hex string tranlates to System.Byte[].

You add the Byte-Array to the string starting with EXEC insertToParty so .Net assumes you want a string representation of that variable. Unless specified it calls .ToString wich gives you .... "System.Byte[]".

Edit: Your stored procedure does not use hex encoding on insert. image data shows in hex when viewed in SQL Studio etc.

If you would encode your byte array to a string using base64 or hex when inserting and decode that when you read the data you only had to worry about the increased storage, but I recommend that you change your db acces from a dynamic SELECT to a prepared statement with parameters:

SqlCommand command = new SqlCommand("Exec InsertToParty(@blob)");
command.Parameters.AddWithValue("@blob", ptObj.PTSymARR);
command.ExecuteNonQuery();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!