开发者

how to save HTML in byte[] as Image??? c#

开发者 https://www.devze.com 2023-02-19 11:19 出处:网络
i have HTML page source of website saved as String in string PageSource; i need to save it in SQL Database as Image开发者_JAVA百科 of type image.

i have HTML page source of website saved as String in string PageSource; i need to save it in SQL Database as Image开发者_JAVA百科 of type image. How to convert PageSource in byte[] and save it as Image in database.


You can use the following code to convert a string to a byte array, which can then be saved in a database image field.

var bytes = Encoding.Default.GetBytes(htmlString);

Use of image will be deprecated, consider using varbinary(max).

0

精彩评论

暂无评论...
验证码 换一张
取 消