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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Nilanka DharmadasaRank #1,875 · 794 reputationPosted Dec 17, 2009, 3:12 AM EST
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 kumarRank #3,110 · 461 reputationPosted Dec 17, 2009, 3:19 AM EST
kiran kumarRank #3,110 · 461 reputationPosted Dec 17, 2009, 3:41 AM EST
kiran kumarRank #3,110 · 461 reputationPosted Dec 17, 2009, 3:47 AM EST
kiran kumarRank #3,110 · 461 reputationPosted Dec 17, 2009, 4:37 PM EST