Forgive if the question is repeated, I'm new to this site.
Been trying to create a search text box for a program that saved and organized documents. The software is database-based, and it can search for only one column at a time. I need it to look for any info in any column (expect date).
Here is the code:
private void textBox2_TextChanged(object sender, EventArgs e)
{
DataView vista = new DataView(tablaSql);
vista.RowFilter = string.Format("asunto_corres LIKE'%{0}%'", textBox2.Text);
dgTodo.DataSource = vista;
}
It works but only with the name of the column specified.
Any help to make this textbox look for info in any field/column.
Thanks
OR). BUT: 1) you can do it inspecting schema (no need to hard code all columns) and 2) use SQL parameters, do not build SQL commands with user inputs (what about SQL injection?).Andrew's cat). I mentioned SQL Injection because it's an easy search topic for Google if he need to search for that.