My standalone Windows app. is written on C# 2008 and back-end is MySQL 5.1.
In a Windows Form, I have a TextBox control on top and a DataGridView below. Initially, as the Form loads, the DataGridView is filled with Item Names of products in sorted order. As and when the user starts typing few letters in the TextBox, the records in the DataGridView starts filtering.
At present a SQL query with LIKE is fired. Though there are no performance issues even after two years, but I am wondering that it is not a better way to fire this query after each key-stroke.
The alternative in my mind is to take all the Item Names in a Collection as the form loads. As the user types, I may use LINQ to filter records from the Collection.
But there is one problem. First, I want to store rows with 5 columns in the Collection, and secondly, there are so many Items, it will consume more memory to hold.
And there is a third concern also. Even if all the five columns are somehow stored in a Collection, how to populate the DataGridView each time with a new set of records when the user starts typing keywords?