Linq data from sql table
How to fetch data from table if customer pass null value as input feild?,I have data in my tabled with value null. I want to pass is null in linq
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Jaimin ShethiyaRank #177 · 13.7K reputationPosted Mar 22, 2021, 12:44 AM EDT
you can just write the below line
var customerList = _context.Customers.Where(x=> x.Name == null || x.Name == string.Empty).ToList();
Thanks
Sachin SinghRank #66 · 26.2K reputationPosted Mar 15, 2021, 6:39 AM EDT
Satya KarkiRank #78 · 24.6K reputationPosted Mar 15, 2021, 8:29 AM EDT
Rijwan AnsariRank #82 · 24.2K reputationPosted Mar 15, 2021, 9:03 AM EDT
Kiran MohantyRank #821 · 2.8K reputationPosted Mar 15, 2021, 7:24 AM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted Mar 15, 2021, 7:54 AM EDT