Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8061629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:24:06+00:00 2026-06-05T10:24:06+00:00

Im having System.Byte[] in SQL 08. i have to convert System.Byte[] into image and

  • 0

Im having System.Byte[] in SQL 08. i have to convert System.Byte[] into image and to display that image in <img> tag in html. im using jquery to get image from mvc and to display it in html.

Im not using View(V) instead of that im using HTML.

MVC 3 Controller

public ActionResult Get_Leave_IO_Pic(DetailsModel model)  
      {
        TCSServiceReference.MBLServiceSoapClient TCSClient = new TCSServiceReference.MBLServiceSoapClient();
        DataSet ds = new DataSet();
        DataSet resultds = TCSClient.Get_Employee_Details_Srno(ds, model.EMPSRNO);
        Image strJSON = null;
        if (resultds.Tables[0] != null && resultds.Tables[0].Rows != null)
        {
            byte[] byteArrayIn = (byte[])resultds.Tables[0].Rows[0]["EMPPHOT"];
            MemoryStream ms = new MemoryStream(byteArrayIn);
            Image returnImage = Image.FromStream(ms);
            strJSON = returnImage;
        }
        return Json(new { result = strJSON });
    }

HTML

 <img src="../images/bis_user.png" width="113" height="104" border="0" alt="" id="ImageStaff" />

jQuery

function GetLeaveIOPic(empsrno) {
   $.post("http://Details/Get_Leave_IO_Pic",
    {
        EMPSRNO: empsrno
    },
    function (data) {
        $.each(data, function (key, value) {
            $('#ImageStaff').val(); //How to get image here?
        });
    }, 'json' );
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T10:24:07+00:00Added an answer on June 5, 2026 at 10:24 am

    Finally i got solution for this.

    ` ======================================= MVC 3 Controller

    public ActionResult Get_Leave_IO_Pic(DetailsModel model)
        {
           TCSServiceReference.MBLServiceSoapClient TCSClient = new TCSServiceReference.MBLServiceSoapClient();
            DataSet ds = new DataSet();
            DataSet resultds = TCSClient.Get_Employee_Details_Srno(ds, model.EMPSRNO);
            string strJSON = "Failed";
            if (resultds.Tables[0] != null && resultds.Tables[0].Rows.Count > 0)
            {
                byte[] byteArrayIn = (byte[])resultds.Tables[0].Rows[0]["EMPPHOT"];
                string EmpName = resultds.Tables[0].Rows[0]["EMPNAME"].ToString();
                MemoryStream ms = new MemoryStream(byteArrayIn);
                Image gotimage = Image.FromStream(ms);
                string filepath = (System.Configuration.ConfigurationManager.AppSettings.Get("ImageUpload")).ToString(); 
                //filepath = E:/Project/project1/Project1 MVC/Images/
                gotimage.Save(filepath + EmpName + " - " + model.EMPSRNO + ".png");
                strJSON = System.Configuration.ConfigurationManager.AppSettings.Get("ImageURL").ToString() + EmpName + " - " + model.EMPSRNO + ".png";
                //ImageURL = http://localhost:8085/Project1MVC/Images/
            }
            return Json(new { result = strJSON });
        } 
    

    ` ======================================= HTML

     <img src="../images/bis_user.png" width="113" height="104" border="0" alt="" id="ImageStaff" />
    

    ` ======================================= jQuery

    function GetLeaveIOPic(empsrno) {
            $.post("http://localhost:8085/Project1MVC/Details/Get_Leave_IO_Pic",
        {
            EMPSRNO: empsrno
        },
        function (data) {
            $.each(data, function (key, value) {
                if (!(data.result == 'Failed')) {
                    // data.result = http://localhost:8085/Project1MVC/Images/name - 23.png
                    $('#ImageStaff').attr('src', data.result.toString());
                }
            });
        },
      'json'
     );
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having the following problem using the Visual Studio 2010 Team System Beta 1:
I remember from past having a utility that would allow to leak various system
I'm having a memory leak issue in a service program that runs SQL scripts
I having some issues with converting a large byte[] array into a strongly typed
I'm having a strange problem - I have about 14.5 million bitmap images, that
Today I have been trying to get an image to save into a database,
I moved my app from silverlight 3 VS2010 to a system having Silverlight 4
I am having an issue with the paging system on Telerik's RadGrid (AJAX). First
Having ListView but I can customizing it only by modifying layout.xml (it's our system
I am having trouble with XMLTextWriter.WriteStartElement throwing an exception: System.InvalidOperationException when trying to write

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.