'How can i ignore Uppercase or lowercase in ado.net linq to sql?
i have this query i want the user to search with the name without uppercase or lowercase , how can i do this ?
join Materiel in ds.Materiel on Accessoir.id_mat equals Materiel.id_mat
join Client in ds.Client on Materiel.Client equals Client.Id
join TypeMateriel in ds.Type_mat on Materiel.TypeMat equals TypeMateriel.id_type_mat
join Atelier in ds.Atelier on Materiel.id_mat equals Atelier.id_mat
join Maint in ds.Maintenancier on Atelier.id_main equals Maint.id_main
join NomAtelier in ds.NomAtelier on Atelier.NomAtelier equals NomAtelier.NomAtelier
join Ticket in ds.Ticket on Atelier.numero_ticket equals Ticket.numero_ticket
where Client.Nom.Contains(textBox1.Text)
select new
{
Client_Nom = Client.Nom,
Client_Prenom = Client.Prenom,
Client_Telephone = Client.Telephone,
Nom_Materiel = Materiel.nom_mat,
Date_Entree = Materiel.date_entree,
Date_Maintenance = Materiel.date_maintenance,
Accessoir = Accessoir.nom_accessoir,
Pannes = Materiel.pannes,
Statut = Materiel.statut_mat,
Prix = Materiel.prix,
Nom_Atelier = NomAtelier.NomAtelier,
Ticket = Ticket.numero_ticket
};```
Solution 1:[1]
Posting here as an answer based on ?s??? ????'s, it's useful for other community members as well.
In your code, change the where condition like below,
First make it Client.Nom either Upper or lower case then search with the user input.
where Client.Nom.ToLower().Contains(textBox1.Text.ToLower())
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | TechieWords |