I have able to insert unusual character (returns 63) to my sql database, no problem with that.
Letsay ProductName = ኣድድድ
and then if I want to insert again but first check if productname exists in database
var product = db.Products.Where(x => x.Productname == txtproduct.Text.Trim()).FirstOrDefault();
then returns as there is already the same product name I mean
if(product == null)
{
Products pr = new Producst();
pr.ProductName = txtProductname.txt.trim() // tried even without trim()
db.Products.Add(pr);
db.Savechanges();
}
else
{
MessageBox.Show("There is the same productname registred"); // Returns allways this one , doesnt't matter which unusual character
}
even if I write with another unusual character like productname = ሰግግግ then it returns "There is the same productname registred". In reality when I type them they are not the same words but when I check their ascii code they returns 63.
I don't want duplicate product names in database. Is there any way to solve this problem? Please help!
txtproduct.Textandtxtproduct.Text.Trim()? Also if you don't need to do something specific withproduct, you might prefer to write something withAnylikeif(db.Products.Any(x => x.Productname == txtproduct.Text))