Hi JennyD6856,
Please refer below sample.
HTML
<asp:Image ID="imgDisplay" runat="server" />
Namespaces
C#
using System.IO;
using System.Linq;
using dbFilesModel;
VB.Net
Imports dbFilesModel
Imports System.IO
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
using (dbFilesEntities entities = new dbFilesEntities())
{
byte[] bytes = (from file in entities.tblFiles
select file.Data).FirstOrDefault();
string base64 = Convert.ToBase64String(bytes);
imgDisplay.ImageUrl = string.Format("data:image/gif;base64," + base64 + ");");
}
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Using entities As dbFilesEntities = New dbFilesEntities()
Dim bytes As Byte() = (From file In entities.tblFiles Select file.Data).FirstOrDefault()
Dim base64 As String = Convert.ToBase64String(bytes)
imgDisplay.ImageUrl = String.Format("data:image/gif;base64," & base64 & ");")
End Using
End Sub
Screenshot