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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:07:48+00:00 2026-05-28T07:07:48+00:00

My problem is when using C# and MySQL database to save some records by

  • 0

My problem is when using C# and MySQL database to save some records by sending parameters.

Although i have already set the charset as Utf-8 and i can see the unicode characters correctly, the problem i get when trying to insert unicode characters is that it only saves half of the string.

The really weird this is that this happens only with unicode strings such as Greek words and only when i send the query with parameters.

Ie. if my query as seen in C# is:

string query = "INSERT INTO tablename VALUES (NULL, @somestring)";

and i set the @somestring parameters value as “TESTING”. This would work just fine.

If i try to set the value as unicode string “ΤΕΣΤΙΝΓ”, the query executes fine with no errors but only saves half the characters in the database, ie. it only saves “ΤΕΣΤ”.

On the other hand if i remove the parameters and adjust the query to be as:

string somestring = "ΤΕΣΤΙΝΓ";
string query = "INSERT INTO tablename VALUES (NULL,'" + somestring + "')";

the query again works just fine AND saves the whole word/sentence in the database.

Hope i explained it correctly and you can understand my situation.

Thanks

  • 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-28T07:07:48+00:00Added an answer on May 28, 2026 at 7:07 am

    The length of how you declare the parameter @somestring is too short in c#.

    UTF-8 takes upto 3 bytes per character so you’d need length to be 21 not 7 for example to fit testing and varieties thereof

    Saying that, I’ve not used c# to call MySQL (only SQL Server) but I’m sure this is the problem

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

Sidebar

Related Questions

I am using CakePHP framework with MySQL database and I have problem in saving
I am using MySQL database to work in ASP.NET MVC 3, i've already set
I have problem with creating a simple MySQL trigger in C#. I'm using StringBuilder
I'm using jQuery + PHP + MySQL My problem is how to save for
I am using mysql database ... I have a table with col name food_type
I have some text stored in MySQL database like this Tom gave Sarah £5
I'm trying to insert some data into a local MySQL database by using MySQL
I have a problem using the Java search function in Eclipse on a particular
I have the following problem using subversion: I'm currently working on the trunk of
I have the following problem using template instantiation [*]. file foo.h class Foo {

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.