S
S
Senture2020-08-15 02:33:59
MySQL
Senture, 2020-08-15 02:33:59

MySQL C# EF LINQ cannot find Russian characters, how to fix?

Good day!
I am currently working with a MySQL database through a C# application using EF + LINQ.

And here is the code:

var user = db.users.Where(x => x.login == "Логин").FirstOrDefault();

finds nothing, although there is such an entry in the table.

Googling, I found only that most likely (not 100%) there is a problem with the encoding in MySQL itself, which encodings I just didn’t set both utf_unicode and utf_general and only set the Russian encoding (I don’t remember the name) nothing helps.

Now, if you make a regular SQL query, then it is enough to substitute N before the value (this is an example from the Internet, to understand how to overcome this in a SQL query: insert into Question (quest) values ​​(N'Which command excludes repetition?'))

Is it possible how can I add this N to LINQ or what needs to be done with the encoding in MySQL?

PS Thank you all!!!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Korotenko, 2020-08-15
@Senture

Try like this. See also which collation.

"DefaultConnection": "server=127.0.0.1;uid=errep;pwd=errep1234567;database=errep;CharSet=utf8;"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question