I get this error when I try this code :
TaxiEntities db = new TaxiEntities();
bool IsUserPassCorrected = db.tblOperators.Any(item => item.UserName.ToLower() == txtUserName.Text.ToLower() &&
item.Password == Convert.ToInt32(txtPassWord.Text));
if (!IsUserPassCorrected)
{
MessageBox.Show("Username or Password is incorrected! Please try again");
}
Since LINQ to Entities does not support Convert.ToInt32
, you need to parse to int
outside LINQ first:
TaxiEntities db = new TaxiEntities();
int password = int.Parse(txtPassWord.Text);
bool IsUserPassCorrected = db.tblOperators
.Any(item => item.UserName.ToLower() == txtUserName.Text.ToLower()
&& item.Password == password);
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