Glad I could Help
One thing I want to tell is that the method you are using could degrad App's performance.
In every key press, it would query the DB and get values. What would happen when the DB grows up?
Try what Comintern has given also.