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?
Using "WHERE" in command with MySQLDependecy
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Using "WHERE" in command with MySQLDependecy
MySqlDependency tracks changes for the whole table. It's not possible to track changes only in some specific records. It is not designed for this purpose.