Skip to content Skip to sidebar Skip to footer

Entity Framework Reading Blob Data Into Html Img

I am trying to read blob data into an html image object. I want to avoid any file creation and handling in the process (unless its unavoidable). My current code is Data table: stud

Solution 1:

I simply had to read image data as byte[] instead of string and it worked.

StudentEntity.cs

publicclassShortStudent
{
  publicstring firstname { get; set; }
  publicint studentid { get; set; }
  publicbyte[] photo { get; set; }
}

and change

sd.photo = Convert.ToBase64String(Serialize(<Blob data from db>));

to

string img = Convert.ToBase64String(<Blob data from db>);

and send in JSon

Post a Comment for "Entity Framework Reading Blob Data Into Html Img"