I assigned a string from database data to c# variable. The string is being assigned properly. I tried using a message box and print the variable and it prints the value properly as a string. But when I compare that variable with another string it doesn't work. It always prints "This is Admin" although the two sides of the comparison is same.
SqlDataReader uid = cmd1.ExecuteReader();
while (uid.Read())
{
string usertype = Convert.ToString(uid[0]);
if (usertype =="User")
{
MessageBox.Show("This is User");
}
else
{
MessageBox.Show("This is Admin");
}
}
uid.Close();