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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:19:12+00:00 2026-06-08T07:19:12+00:00

I am getting error Input string was not in a correct format when trying

  • 0

I am getting error "Input string was not in a correct format" when trying to update a table via the MySQL .NET connector.

The update statement works fine when run via MySQL workbench, but not via code and I am hoping someone can tell me why.

Code is:

MySqlCommand command = new MySqlCommand();
command.Connection = conn;
command.CommandText = "update fulfilled_shipments_data set addedCustomer=1 where amazonOrderId like '" + amazonOrderId + "%';";
command.ExecuteNonQuery();

I have tried both executing as a non query, and as ExecuteReader(); with no luck.

I am sure this is a simple mistake I am making, but I can’t seem to find it for the life of me so any help would be greatly appreciated.

— Edit —
I have tried the following with no luck:

MySqlCommand command = new MySqlCommand();
command.Connection = conn;
command.CommandText = "update fulfilled_shipments_data set addedCustomer=1 where amazonOrderId like '@amazonOrderId';";
command.Parameters.AddWithValue("@amazonOrderId", amazonOrderId);

also changed CommandText to:

 command.CommandText = "update fulfilled_shipments_data set addedCustomer=1 where convert(varchar(50), amazonOrderId) like '" + amazonOrderId + "';";

and

 command.CommandText = "update fulfilled_shipments_data set addedCustomer=1 where amazonOrderId = '@amazonOrderId';";

and

command.CommandText = "update fulfilled_shipments_data set addedCustomer=1 where amazonOrderId = @amazonOrderId;";

— Resolution —

My resolution was actually found in another piece of code. After running through the debugger several times it became apparent that a MySqlConnection object was trying to be instantiated twice – with the same name etc. I removed the second instantiation and it has resolved the issue. It’s too bad the error was misleading.

I appreciate everyone’s responses as I feel they have made my code better and as such I have given +1’s to Jon, Steve and Chris. Thanks for the help!

  • 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-08T07:19:15+00:00Added an answer on June 8, 2026 at 7:19 am

    My resolution was actually found in another piece of code. After running through the debugger several times it became apparent that a MySqlConnection object was trying to be instantiated twice – with the same name etc. I removed the second instantiation and it has resolved the issue. It’s too bad the error was misleading.

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

Sidebar

Related Questions

I'm using .NET 4 and getting Input string not in correct format error when
I am getting an exception error, Input string was not in a correct format.
I'm getting a FormatException: Input string was not in a correct format error that
I am getting this error: Error: Format Exception: Input string was not in a
I am getting the following Exception: Input string was not in a correct format
I'm getting the error: parser error : Input is not proper UTF-8, indicate encoding
I was trying to decode the following string and getting a error. item =
I am getting following error when I am trying to use Convert.FromBase64String The input
I'm trying to do: raw_input(Anyone Home?) But I'm getting syntax error! I'm using Python
When I input locations from a txt file I am getting a peculiar error

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.