I am designing a project on ASP.NET MVC 3.
I am using this query in my controller:
int batchSize = (int)db.ProductFormulation
.Where(r => r.ProductID == p)
.Min(r => r.Quantity);
Where p is input by the user.
When i run my project and user enter a value of p which does not exist in my table then an error occurrs.
How can i stop this error, e.g a message box should be created that states there does not exist record for value you entered, and my project should run continuously.
Please suggest me what should i do for it. Thanks in advance.