I'm trying to get this code working, but every time I debug it, I come across this error.
This is my code:
private void button3_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConnectionString);
SqlDataAdapter sda = new SqlDataAdapter($"Select Count(*) from Table Where 'Utilizador=' '{textBox1.Text}' and Passe='{textBox2.Text}'", selectConnection: con);
DataTable dt = new DataTable();
sda.Fill(dt);
if (dt.Rows[1][2].ToString() == "1")
{
this.Hide();
Form2 ss = new Form2();
ss.Show();
}
else
{
MessageBox.Show("Utilizador e/ou Palavra Passe errados. Caso o erro pressista contacte o administrador de sistema.", "SiGiG - Alerta");
}
}
The error is
System.Data.SqlClient.SqlException: 'incorrect syntax near 'table'.'
and is thrown on this line of code:
sda.Fill(dt);
I appreciate all the help I can get, and sorry about my English.