When I run this query in linqpad:
Customer.Where(c => (c.CustomerName == "test"))
It returns a record that matches.
When I try running the same query in visual studio it does not return any matching records. This is the code I am using:
List<Customer> customerList = new List<Customer>();
using (DBEntities db = new DBEntities())
{
try
{
customerList = db.Customer.Where(c => (c.customerName == "test")).ToList();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
return customerList;
Can anyone see why this it works in linqpad but does not work in visual studio?
can you try out like this
because there may be problem with the Casesensitive search for customer name.
Try other variation of : String.Compare Method as per you need