Operators in C#
if (dr["username"].ToString = TextBox1.Text&& dr["uid"].ToString =TextBox2.Text) Error"Operator '&&' cannot be applied to operands of type 'string' and 'method group'"
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Nilanka DharmadasaPosted Dec 17, 2009, 8:12 AM
Write this way.
if ((dr["username"].ToString() == TextBox1.Text) && (dr["uid"].ToString() ==TextBox2.Text))
{
}
Or write this way.
if ((dr["username"].ToString().Equals(TextBox1.Text)) && (dr["username"].ToString().Equals(TextBox2.Text)))
{
}
If you find any other problem pls ask.
If this is helpful to you, please check Do you like this answer' checkbox.
kiran kumarPosted Dec 17, 2009, 9:37 PM
kiran kumarPosted Dec 17, 2009, 8:47 AM
kiran kumarPosted Dec 17, 2009, 8:41 AM
kiran kumarPosted Dec 17, 2009, 8:19 AM