[英]How to get binary to image from database using vb.net
Convert binary to image using VB.NET from database. 使用VB.NET从数据库将二进制文件转换为图像。 I have stored images as binary format in SQL database.
我已将图像以二进制格式存储在SQL数据库中。 How to retrieve those value to image using vb.net
如何使用vb.net将这些值检索到图像
bytes = CType(dt.Rows(0)("Data"), Byte())
ImgPrv.ImageUrl = bytes
I would suggest converting the bytes to a Base64 string and applying that to the image url: 我建议将字节转换为Base64字符串,并将其应用于图像url:
bytes = CType(dt.Rows(0)("Data"), Byte())
Dim base64String As String = Convert.ToBase64String(bytes, 0, bytes.Length)
ImgPrv.ImageUrl = "data:image/png;base64," & base64String
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.