Rather than write code that is chatty with the database, it is possible to pull all the data that your user could ever need from a table or procedure and store it in a dataset. Normally you would then drop in a binding source to link up your datagrid and the dataset. In some cases, you may want to search the data in the grid to find a particular piece of data. Maybe you want to give your users the ability to enter a value in a search box and navigate directly to that record. Using the binding source, this is as simple as two lines of code.
Here it is:
int itemFound = bindingSource.Find(”Field”, Convert.ToInt32 (ValueToFind));
bindingSource.Position = itemFound;