B
Bob Sillett
This is one of those issues that doesn't clearly fit into a single category
as it's both a C# and a database (mySql) issue.
I want to INSERT and SELECT text in UTF8 from a C# application to mySql.
My database character set is UTF8. I am using the native .NET provider from
mysql.com. Everything is at the current version.
My C# code for INSERT looks like this:
cmdMySql.CommandText = "INSERT INTO tblCommunity (Details) VALUES
(?Details)";
MySqlParameter P = new MySqlParameter();
P.MySqlDbType = MySqlDbType.String;
P.ParameterName = "?Details";
P.Value = "Any Russian text string";
cmdMySql.Parameters.Add(P);
cmdMySql.ExecuteNonQuery();
This works, but my Unicode text (Russian) ends up as ???????????????????? in
the database. When I'm in the C# debugger, I can see the Russian text as I
step through the code. So I know my problem is somewhere in how I'm passing
the data to the database. I have also tried a vanilla INSERT statement with
no parameters. It also gives me ??????????? for the Russian text. And if
my string mixes English and Russian, the English text is fine.
Does anyone have any ideas as to what I'm doing wrong?
Thanks.
Bob
as it's both a C# and a database (mySql) issue.
I want to INSERT and SELECT text in UTF8 from a C# application to mySql.
My database character set is UTF8. I am using the native .NET provider from
mysql.com. Everything is at the current version.
My C# code for INSERT looks like this:
cmdMySql.CommandText = "INSERT INTO tblCommunity (Details) VALUES
(?Details)";
MySqlParameter P = new MySqlParameter();
P.MySqlDbType = MySqlDbType.String;
P.ParameterName = "?Details";
P.Value = "Any Russian text string";
cmdMySql.Parameters.Add(P);
cmdMySql.ExecuteNonQuery();
This works, but my Unicode text (Russian) ends up as ???????????????????? in
the database. When I'm in the C# debugger, I can see the Russian text as I
step through the code. So I know my problem is somewhere in how I'm passing
the data to the database. I have also tried a vanilla INSERT statement with
no parameters. It also gives me ??????????? for the Russian text. And if
my string mixes English and Russian, the English text is fine.
Does anyone have any ideas as to what I'm doing wrong?
Thanks.
Bob