ERROR C# MVC5 using ADO.NET when update columns using Chinese in mysql(version:5.7.27-0ubuntu0.18.04.1 - (Ubuntu)): {"Incorrect string value: '\xE4\xB8\xAD\xE6\x96\x87' for column 'Title_1' at row 1"}
I have already tried charset for database, table and columns.
(1)'utf8' 'utf8_general_ci'
(2)'utf8' 'utf8_unicode_ci'
(3)'utf8mb4' 'utf8mb4_general_ci'
(4)'utf8mb4' 'utf8mb4_unicode_ci'
Also,I've added charset=utf8mb4 or charset=utf8 in connectionstring in Web.config
my connection string is
<add name="constr" connectionString="Data Source=ServerIP;port=3306;Initial Catalog=jn001;User Id=Userid;password=Password;charset=utf8mb4">
Google all day finding answers, Still can't find a solution, Please tell me a solution,Thanks!
I've followed LocEngineer's advertisement and set mysql server to utf8mb4
All change to utf8mb4 (including connectionstring) ,but still the same error occur.
Anyway ,thanks for the suggestions.
------------------------------9/5update--------------------------------
 public bool UpdateDetails(Class1 content)
        {
            connection();
            MySqlCommand cmdSet = new MySqlCommand("set names utf8mb4", con);
            MySqlCommand cmd = new MySqlCommand("update", con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@Title_1",content.Title_1);
            cmd.Parameters.AddWithValue("@Title_2", content.Title_2);
            cmd.Parameters.AddWithValue("@Title_3", content.Title_3);
            cmd.Parameters.AddWithValue("@Content_1", content.Content_1);
            cmd.Parameters.AddWithValue("@Content_2", content.Content_2);
            cmd.Parameters.AddWithValue("@Content_3", content.Content_3);
            con.Open();
            cmdSet.ExecuteNonQuery();
            int i = cmd.ExecuteNonQuery();
            con.Close();
            if (i >= 1)
                return true;
            else
                return false;
        }
this is mysql update Procedure
UPDATE Stop_Info SET Title_1 = Title_1,Title_2=Title_2,Title_3=Title_3,Content_1=Content_1,Content_2=Content_2,Content_3=Content_3 WHERE Pkey = 3
HTML form accept-charset="utf-8"
<form id="registerForm" method="post" action="~/Home/Index" class="form-horizontal" accept-charset="utf-8">
 
     
     
    