Hi,
I have a database on my website that's 100% UTF8.
My PHP pages can read, display and set Chinese values well.
I have a MySQL connection on my XP64: Encoding 65001 UTF8
And there's database that's utf8 & utf8_general_ci
In that, there's a table: field sSPzht: utf8 & utf8_general_ci
When my C# app gets Chinese text from the web, and updates the field sSPzht: I see "????".
This is an encoding issue. But where?
More information:
=================
MySQL connection strings:
Web: Server=74.220.xxx.xxx;Port=3306;Database=xxx;Uid=x xx;Pwd=xxxx;CharSet=UTF8;"
XP64: Server=localhost;Port=3306;Database=smoreports;Uid =root;Pwd=xxxx;CharSet=UTF8;"
Navicat
-------
Using Navicat: I can type Chinese into the sSPzht field successfully.
Using the the C# code...
string idSP = "2";
string dat = SMOMain.GetHMData(tbl, "sSPzht", "idSP=" + idSP, true);
sql = "UPDATE " + tbl + " SET sSPzht='" + dat + "' WHERE idSP=" + idSP + ";";
// Set data
lbl1.Text = dat;
txt1.Text = dat;
..Will put the Chinese into a TextBox and label that is displayed perfectly.
Using Navicat: I can copy the Chinese from the TextBox on a C# form and paste it into my sSPzht field succesfully.
Here's my issue:
sql = "UPDATE " + tbl + " SET sSPzht='" + dat + "' WHERE idSP=" + idSP + ";";
MySqlCommand myCommand = new MySqlCommand(sql, myConnection);
myCommand.ExecuteNonQuery();
The above code only puts ???? into the sSPzht field.
What am I missing?
Thanks