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 8653611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:35:08+00:00 2026-06-12T14:35:08+00:00

currently i am working with ASP.NET and C# to store image into MySQL (using

  • 0

currently i am working with ASP.NET and C# to store image into MySQL (using blob datatype). I’m storing it successfully into database, but now problem is, How can I retrieve that byte[] to image format ?

FUNCTION: code to convert byte[] to image

public Image byteArrayToImage(byte[] byteArrayIn)
    {
        MemoryStream ms = new MemoryStream(byteArrayIn);
        Image returnImage = Image.FromStream(ms); --> here gives me error as `parameter is not valid`
        return returnImage;

    }

retieved as datatable…

if (dt1.Rows.Count > 0)
        {
            byteArrayToImage((byte[]) dt1.Rows[0]["PortfolioSlideImages"]);
            //MemoryStream ms = new MemoryStream((byte[])dt1.Rows[0]["PortfolioSlideImages"]);
            //Image returnImage = Image.FromStream(ms);
            //return returnImage;
        }
  • 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-12T14:35:09+00:00Added an answer on June 12, 2026 at 2:35 pm

    Try this function,

    public Image byteArrayToImage(byte[] byteArrayIn)
    {
         Image returnImage = null;
         using (MemoryStream ms = new MemoryStream(byteArrayIn))
         {
             returnImage = Image.FromStream(ms);
         }
         return returnImage;
    }
    

    for more info, visit this link

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My website currently working in ASP.NET 1.1 Old Process In our database we have
I am currently working in ASP.NET MVC 4 while using the entity framework. I've
I am currently working on an ASP.NET MVC project. Some developers on the team
I'm currently working on an ASP.Net WebForms application that allows a user to select
I'm currently working on an ASP.NET site created by someone else. There is this
I'm currently working on an ASP.NET web-site. In one of my pages, I had
I'm currently working on a ASP.Net 3.5 project and trying to implement session timeout
I'm currently working on an Asp.net MVC Web application. In my solution, there're two
I am currently working on a ASP.NET AJAX application. Having decided to not use
The ASP.net page I am currently working on has a drop down list that

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.