I'm making a program with a login page and this error came up when coding it: Operator == cannot be applied to operands of type byte[] and string
Im not sure where to go with it or how to handle it. This is my section with the error:
private void button1_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBox1.Text))
{
MessageBox.Show("Please Enter your username.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
textBox1.Focus();
return;
}
try
{
using (DataEntities test = new DataEntities())
{
var query = from o in test.Users
where o.Username == textBox1.Text && o.Password == textBox2.Text
select o;
if(query.SingleOrDefault() != null)
{
MessageBox.Show("You have been successfully logged in.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
//Add your code process login here
}
else
{
MessageBox.Show("Your username or password is incorrect.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
Thanks in advance!