Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,

I have grid view with 4 column ( ID , name ,sub , age ) . and i write code for search on them from data grid.
C#
private void button4_Click(object sender, EventArgs e)
        {
 DataView dv = new DataView(dbdataset);
dv.RowFilter = string.Format("name LIKE'%{0}%'OR sub LIKE'%{0}%'OR age LIKE'%{0}%'",txt.Text);
 dataGridView1.DataSource = dv;
        }


But this error appear to me ( Cannot perform 'Like' operation on System.DateTime and System.String.)

Any one can help me in this?

Kind Regards,
Posted
Comments
ZurdoDev 25-Apr-14 14:41pm    
What is in txt.Text? And which one of your columns is a datetime?

The LIKE operator only works on strings. It does not work on any other datatype. It's telling you that's what you're trying to do. Check the data types of your columns in the datatable.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900