using (RapidWorkflowDataContext context = new RapidWorkflowDataContext())
{
var query = from w in context.WorkflowInstances
from c in context.Workflows
where EmpWorkflowIDs.Contains((int)w.ID) && w.CurrentStateID != c.LastStateID
select w;
return query.ToList();
}
I have 2 tables: Workflows and WorkflowInstances.
Workflows to store objects and workflowInstances to store instances.
Workflows Table: ID,Name,FirstStateID,LastStateID
WorkflowInstances Table: ID,Name,WorkflowID,CurrentStateID
How to write a query in linq to sql to select the instances from WorkflowInstances which CurrentStateID not equal LastStateID
Perform the equivalent of an SQL IN with IEnumerable. Contains().
Linq not equal(!=)
In LINQ, the Except method or operator is used to return only the elements from the first collection, which are not present in the second collection.
If you are using lambda expressions, then not(!)
goes there:
.Where(p => !p.Whatever...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With