linq query to check if record exists
if (dc.Users.Any(u => u.Name == name))
{
// Do something here
}
linq query to check if record exists
if (dc.Users.Any(u => u.Name == name))
{
// Do something here
}
check if an element is in data base linq lambda
string s = textBox1.text;
var xmyTable = (from ymyTable in objDataContext.myTables where ymyTable.myName == s
Select new {ymyTable.myCode,ymyTable.myNmae}).FirstorDefault();
if(xmyTable.Count>0)
{
//your logic for record found.
}
else
{
//your logic for record not found
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us