Archive for the ‘LINQ to SQL’ Category

Check If Record Exists

Posted: November 9, 2011 in LINQ to SQL

To check if a record already exists in a table, you can try the following:

if (context.YourTableName.Any(u => u.YourColumnName == YourTextMatch))
{
  // Record found
}
else
{
  // Record not found
}