I have a program that stores the name, author, and ISBN of a book in a XML file. The program works, but I have problem with the search button, it only filter by the whole, but I need it to filter by any word.
I have been searching, and I found this:
private void FilterByType(string type)
{
var dataView = ((DataTable) this.dataGridView.DataSource).DefaultView;
dataView.RowFilter = "(Type = '" + type + "')";
}
and this:
dataView.RowFilter = "(Type LIKE *'" + substring + "*')";
The first one works, but like I said it looks for the whole name, and when I try to use the second one I get this message “Syntax error: Missing operand before’*’ operator”.
Hope you can help me, and thanks.
You misplaced the
*. It should beComplete reference here.