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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:03:42+00:00 2026-06-13T05:03:42+00:00

I am using Asp.net with C# and back-end MySql to keep Images as byte[]

  • 0

I am using Asp.net with C# and back-end MySql to keep Images as byte[] array with using BLOB datatype

TABLE : ImageLog

ImgID                 int (auto increment)
ImageLogo             blob 

I am using following function to convert image to array...

private byte[] ConvertImageToByteArray(FileUpload fuImgToByte)
    {
        byte[] ImageByteArray;
        try
        {
            MemoryStream ms = new MemoryStream(fuImgToByte.FileBytes);
            ImageByteArray = ms.ToArray();
            return ImageByteArray;
        }
        catch (Exception ex)
        {
            return null;
        }
    }

here is calling method for creating byte[] bt to insert into MySql

Byte[] bt = null;
bt = ConvertImageToByteArray(FileUploader1); --> Passing File Uploader ControlID

inserting like…

INSERT INTO IMAGELOG (ImageLogo) VALUES ('"+bt+"');

Now, Program runs perfectlly without causing any errors but when image stored into MySql, it stored like System.Byte[] not into byte[] array. Result Something like this…

ImgID      ImageLogo
________________________________
  1        System.Byte[]    13K ( Length )  < ----- > not storing byte[] in proper format
  2        System.Byte[]    13K ( Length )

Please tell me is it in proper format ? ? or not ?? Every suggestions are welcome.
Thanks in advance

  • 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-13T05:03:44+00:00Added an answer on June 13, 2026 at 5:03 am

    Problem Solved After Lot’s of Difficulties… Simply Add Parameters With ? instead passing byte array bt directly within Insert Query…Something like this:

    INSERT INTO IMAGELOG (ImageLogo) VALUES (?p1) and Pass values something like this

    cmd.Parameters.Add(“?p1”, bt); <– Adding parameter p1 value here

    Note: If you are using MySql as database end then i suggest to use ? instead @ symbol.

    OUTPUT:

    ImgID      ImageLogo
    ________________________________
      1        Binary Image    73K ( Length ) < ----- > You can see the difference...
      2        Binary Image    69K ( Length )
    

    Hope It Helps You All, Chears. !!

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

Sidebar

Related Questions

I'm using Asp.net c# and MYSql as back-end. I'm updating a table,but table is
I create asp.net mvc application using mysql as the database in the back end.
I am building a website using Asp.net with C# and back end support is
I have an ASP.Net website which uses a MySQL database for the back end.
I have been develop API using asp.net with C# back-end code. i would like
I'm building an HTML5 application (with ASP.NET back-end) and i want to develop it
I'm developing chat application. I use flash as front end and asp.net back-end. My
I'm currently building the Admin back-end for a website in ASP.NET MVC. In an
I have an ASP.NET 3.5 application with SQL 2005 at back end. In some
I am creating a webpage which is using asp .net as its backend. I

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.