Using "WHERE" in command with MySQLDependecy
Posted: Thu 18 Oct 2018 22:07
Hi, I'm testing the dotnet conector for mysql and I'm trying to fire OnChange handler in a WHERE statement in my sql command but when I update, insert or delete something in table wich is not in WHERE statement, the envent fires even.
This is my code:
void Start()
{
MySqlConnection connection = new MySqlConnection(constring);
connection.Open();
MySqlCommand Orcamento_Cadastrado = new MySqlCommand("SELECT id, usuario_id, mensagem, lida, data, negocio_id FROM mensagem_usuario WHERE id='0'", connection);
MySqlDependency dependency = new MySqlDependency(Orcamento_Cadastrado, 100);
dependency.OnChange += new OnChangeEventHandler(dependency_OnChange);
MySqlDependency.Start(constring);
}
Is there a way to do this or what I'm doing wrong?
This is my code:
void Start()
{
MySqlConnection connection = new MySqlConnection(constring);
connection.Open();
MySqlCommand Orcamento_Cadastrado = new MySqlCommand("SELECT id, usuario_id, mensagem, lida, data, negocio_id FROM mensagem_usuario WHERE id='0'", connection);
MySqlDependency dependency = new MySqlDependency(Orcamento_Cadastrado, 100);
dependency.OnChange += new OnChangeEventHandler(dependency_OnChange);
MySqlDependency.Start(constring);
}
Is there a way to do this or what I'm doing wrong?