我如何在 ado.net linq to sql 中忽略大写或小写字母?
How can i ignore Uppercase or lowercase in ado.net linq to sql?
我有这个查询,我希望用户使用不带大写或小写的名称进行搜索,
我该怎么做?
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
};```
在此发布作为基于 ɐsɹǝʌ ǝɔıʌ 的答案,它对其他社区成员也很有用。
在您的代码中,像下面这样更改 where 条件,
首先将其设为 Client.Nom Upper 或 lower[=26] =] case 然后用用户输入搜索。
where Client.Nom.ToLower().Contains(textBox1.Text.ToLower())
我有这个查询,我希望用户使用不带大写或小写的名称进行搜索, 我该怎么做?
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
};```
在此发布作为基于 ɐsɹǝʌ ǝɔıʌ 的答案,它对其他社区成员也很有用。
在您的代码中,像下面这样更改 where 条件,
首先将其设为 Client.Nom Upper 或 lower[=26] =] case 然后用用户输入搜索。
where Client.Nom.ToLower().Contains(textBox1.Text.ToLower())