How to prevent inserting question marks (???) in MySQL while working with C#.NET?

Problem :

As a PHP developer, I always use the code below whenever I want to work with PHP and MySQL on Unicode contents:

$link = mysql_connect("localhost","root") or die (mysql_error());
if ($link) {
    $db = mysql_select_db("mydb") or die (mysql_error());

In this case all contents will store exactly in MySQL database.

Now, I have a windows application written in C#.NET and I have to join it with MySQL database and store something in database through it. But all contents save as ??? marks.

How can I solve this problem ?

Solution :

You need to tell your C# code that the MySQL database uses UTF8 encoding by including that information in your connection string, e.g.:


Mysql Tutorials

Mysql Howto..

How to add value to SET field in mysql?

How to optimize foreach loop in PHP

how to use Fuzzy look up to find the sentence in SQL?

How to shift column name to result set in MySQL?

How to get maximum and average of a field from mysql table with some conditions

How to configure case sensitive database identifier in mysql

How to select a query for a selected day[2010-11-04] to present date using mysql

How often can I query MySQL database through PHP [closed]

How to assign N bytes to store integer instead of 4 bytes or 8 bytes in mysql?

MySQL - How can i query a multi-value field to match a primary key of another table?

How to convert given number of days to years, months and days in MySQL?

How to get results from the query if the selected date is between two dates?

How to count users ahead and behind of a particular user in PHP MYSQL

How to do a right outer join in MySQL? [duplicate]

How to further filter GROUP BY record in mysql?

how to insert image in mysql database using and adodb connection

MySQL: How to get a sequential number with rows?

How to take unicode characters from the mysql data base in PHP

How to optimize this mysql query? Runs slow

How to agregate/group php array by SQL timedate/unix timestamp?

How to generate count query for a group by select query in MySql

How to get corresponding value from max(datetime) with MySQL?

how to query mysql on the current week?

How do I see what a MySQL view is made of?

how to repeatedly retrieve certain amount of data from a large data set?

How to remove potentially bad data from PHP and PDO MySql

MysQL : How to set default value for empty row?

How to dynamically add values to google geochart through mysql?

how to work with iBatis

How do I count the number of visits to my site on a date with mysql?