i get an error which says incorrect syntax near keyword user at the com.executequery line when i run this code. what am i doing wrong?
internal bool IsThereRegisteredUser()
{
SqlConnection m = new SqlConnection();
m.ConnectionString = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\UserDatabase.mdf;Integrated Security=True";
m.Open();
string query = @"SELECT COUNT(username) FROM user";
SqlCommand com = new SqlCommand(query, m);
//SqlDataReader h = new SqlDataReader();
//h = com.ExecuteReader();
//h.Read();
int userNum = com.ExecuteNonQuery();
if (userNum > 1)
{
return true;
}
else
{
return false;
}
}