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

  • Home
  • SEARCH
  • 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 6934535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:58:21+00:00 2026-05-27T11:58:21+00:00

I have a client application in C#, which is meant to take in the

  • 0

I have a client application in C#, which is meant to take in the location of an image (DataType: VarChar). This application is then supposed to invoke a web service, which in turn will store the Image (NOT the location) in a local MySQL Database.

The problem is, I realized that i am able to pass all the other data from the form to the database EXCEPT for the image…Can anyone please point out what I am doing wrong here? Any help will be greatly appreciated.

ps – I know that a lot of you will be suggesting me to save the images in a file system rather than on the database itself….but the thing is, my database is not that big anyways so saving the images on the database itself will not be that big of a deal hopefully 🙂

Here is my table in MySQL,

create table testImage(
id int not null auto_increment,
name varchar(50),
age int,
image blob,
primary key(id));

And here is the WebMethod which is meant to insert the data into the table…it works when the image field is commented out.

[WebMethod]
        public string sendDataToMySql(string get_name, int get_age, byte[] buffer)
        {
            string MyConString = "SERVER=localhost;" +
                  "DATABASE=test;" +
                  "UID=root;" +
                  "PASSWORD=password;";

            string name_new = get_name;
            int age_new = get_age;
            byte[] buffer_new = buffer;


            MySqlConnection connection = new MySqlConnection(MyConString);
            connection.Open();
            MySqlCommand command = new MySqlCommand("", connection);
            command.CommandText = "insert into testdata(name, age, image) values(@name, @age, @image);";

            command.Parameters.AddWithValue("@name", name_new);
            command.Parameters.AddWithValue("@age", age_new);
            command.Parameters.AddWithValue("@image", buffer_new);

            command.ExecuteNonQuery();

            connection.Close();

            return "Task Performed!";

        }
  • 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-05-27T11:58:22+00:00Added an answer on May 27, 2026 at 11:58 am

    I don’t think you need to declare the buffer_new variable at all, you can simply use the buffer parameter as it is.

    my guess is that you should assign the MySql.Data.MySqlClient.MySqlDbType.Blob data type to the @Image parameter not just AddWithValue…

    check here for a full example: Insert blob into MySQL

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

Sidebar

Related Questions

I have a client application which runs as a Java applet from a user's
I have a .net client application which is connected to a remote database. Is
I have a client server application in which the server and the client need
I have a client server application in which I need to transmit a user
We have a Server/Client cybercafe management application which used to work fine on Windows
I want to create an application which will have a client and server components.
I have an application which must save client instances of com.smartgwt.client.widgets.Canvas to a disk
I have an application which get copied and run on client machines. The program
I have a client-server Silverlight application, which is use Socets. I have server appliaction
I am developing an application in C# WPF which will have Client-Server architecture (Client

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.