Search in textbox
-
Hello, I created table and loaded it on data-grid view. MySqlCommand cmddatabase = new MySqlCommand("select number as 'رقم', date as'تاريخ ',name as (أسم);", condatabase); Now i want search on the name from textbox. So i did like this private void txt_in11_TextChanged(object sender, EventArgs e) { DataView dv = new DataView(dbdataset); dv.RowFilter = string.Format(" 'name' LIKE '%{0}%'",txt_in11.Text); dataGridView1.DataSource = dv; } My problem when i search on the name nothing appear in the table. it appear is clear although i inserted in the table some rows. So please can any one help me in this .
-
Hello, I created table and loaded it on data-grid view. MySqlCommand cmddatabase = new MySqlCommand("select number as 'رقم', date as'تاريخ ',name as (أسم);", condatabase); Now i want search on the name from textbox. So i did like this private void txt_in11_TextChanged(object sender, EventArgs e) { DataView dv = new DataView(dbdataset); dv.RowFilter = string.Format(" 'name' LIKE '%{0}%'",txt_in11.Text); dataGridView1.DataSource = dv; } My problem when i search on the name nothing appear in the table. it appear is clear although i inserted in the table some rows. So please can any one help me in this .
Your
DataView
doesn't contain a column called "name"; it contains a column called "(أسم)". Either change yourRowFilter
to match the column alias, or change the column alias to match yourRowFilter
.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer