Handle null on checking DB
I'm having some real issues with handling a null reference when checking my database for a username and password on the below code.
If the username and password match it works, but if it doesn't or the username + password textboxes are empty it throws a null execption?
How can I handle the null on the below?
if (strResult.Length == 0)
{
label1.Text = "INCORRECT USER/PASS!";
}
else
{
label1.Text = "YOU ARE LOGGED IN!";
}
}