C# web service, MySql encoding problem

Posted by Boban on Stack Overflow See other posts from Stack Overflow or by Boban
Published on 2010-11-12T19:07:24Z Indexed on 2010/12/30 19:54 UTC
Read the original article Hit count: 267

Filed under:
|
|
|

I use C# web service to insert, delete and get data from MySql database. The problem is some of the data is in Macedonian (Cyrilic).

When I insert directly in the database, it inserts ok. For example: "???" is "???". When I insert throgh the service, it's not. For example: "???" is "???". When I try to get data throug the service, it gets it ok. What's the problem with the inserting?

Here is part of my code for inserting:

    MySqlConnection connection = new MySqlConnection(MyConString);
    MySqlCommand command = connection.CreateCommand();
    command.CommandText = "INSERT INTO user (id_user, name VALUES (NULL, ?name);";
    command.Parameters.Add("?name", MySqlDbType.VarChar).Value = name;
    connection.Open();
    command.ExecuteReader();

    connection.Close();
    return thisrow;

Tnq U in advance!!!

© Stack Overflow or respective owner

Related posts about c#

Related posts about mysql