简体   繁体   English

如何使用vb.net从数据库获取二进制图像

[英]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.

相关问题 如何使用asp.net + vb.net从数据库列中获取数据并显示在下拉列表中 - How to get data from database column and display in dropdownlist using asp.net + vb.net 如何使用VB.NET计算数据库中的记录? - How to count records from database using VB.NET ? 使用 http 处理程序从 vb.net 中的 SQL 服务器数据库中检索图像 - Retrieving an image from a SQL Server database in vb.net using a http handler 如何从SQL Server数据库中检索图像字段civilimage1,civilimage2,以在带有vb.net或c#的ASP.NET中使用图像控件进行显示? - How to retrieve image fields civilimage1,civilimage2 from SQL Server database to show using image control in ASP.NET with vb.net or c#? 如何使用asp.net(vb.net)将文本框中的数据保存到mysql数据库 - How to save data from text box to mysql database using asp.net (vb.net) vb.net使用ashx处理程序从SQL Server获取图像 - vb.net using ashx handler to get image from SQL Server 如何使用Vb.Net中的连接字符串将数据库中的数据获取为mu UI形式 - How to get the Data in the database to mu UI form using Connection string in Vb.Net 如何在vb.net中使用网格视图删除数据库中的数据 - How to delete data in database using grid view in vb.net 如何在ASP.Net上使用VB.Net从DataTable获取1列数据并将其显示给Lable - How to get 1 column data from DataTable and display it to Lable using VB.Net on ASP.Net 使用VB.net从gridview获取列值 - Get column value from a gridview using VB.net
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM