This is what I have done
bool query = ( from n in CDC.NCDCPoints
where n.EVENT_TYPE_ID == et
where n.BeginDate == b
where n.EndDate == e
select n).Count()>0;
var dupli = (from n in CDC.NCDCPoints
where n.EVENT_TYPE_ID == et
where n.BeginDate == b
where n.EndDate == e
select n);
if (query)
{
return new JavaScriptSerializer().Serialize(dupli);
}
else
{
return "No duplicate";
}
When I try to convert it into a JSON string, I get a circular reference error. The error occurs at the Serialize step. So, I think probably I get an error because it is an invalid object or something. Do I need to use something like Iqueryable or something. Please help me in getting rid of this error?
.Any()extension instead ofCount() > 0wheres instead of just using&&, or definingduplioutside of the scope in which you use it?