2

i have already searched but could not find the proper answer. see the below code and tell me what to do. the name of my imagebox is picbox thanks in advance

try
{
int w = Convert.ToInt32(RegID.Text);
byte[] image = null;
{
var photoRecord = (from accom in re.Students
                    where accom.RegistrationNo == w
                    select accom).First();
image = photoRecord.Picture;

}

}
catch (Exception)
{
throw;
}
2
  • Are you getting a compile error or a runtime error? What type is photoRecord? There is not enough information to answer this question. Commented Mar 18, 2015 at 15:27
  • @default.kramer I appreciate your effort but r.hamad has answered my question and it just worked fine. Commented Mar 18, 2015 at 15:30

1 Answer 1

2

i have added only two lines and it must perfectly work

try
{
int w = Convert.ToInt32(RegID.Text);
byte[] image = null;
{
var photoRecord = (from accom in re.Students
                where accom.RegistrationNo == w
                select accom).First();
image = photoRecord.Picture;
string base64String = Convert.ToBase64String(image, 0, image.Length);
picbox.ImageUrl = "data:image/png;base64," + base64String;
}
}
catch (Exception)
{
throw;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.