Wildcard filter for numeric/date fields in dataset -
11-14-2007
, 01:54 AM
Hi,
I need to do a wild card search for all the fields in my table irrespective
of whether its a numeric/date or string field . The data should filter only
these data and show in the datagridview while I bound the datatable to it.
Lets say I have the following table
Name | DOB | SAL | Address
Jane |25/12/1976 | 25000 | Parkview boulevard
Hart |19/10/1988 | 16000 | Hunstville
Charles |15/12/1968 | 28000| Atlanta
Kate |25/12/1975 | 25000 | Parkview boulevard
Ron |25/12/1978 | 25000 | Parkview boulevard
Juane |25/12/1973 | 25000 | Parkview boulevard
Nick |25/12/1972 | 25000 | Parkview boulevard
Lets assume that this data is already there in my dataset with a data
tablename "Employee" and dataset name "dsEmployee"
While I give a search in this like
dsEmployee.tables["Employee"].DefaultView.RowFilter = "name like '%25/12%'
OR DOB like '%25/12%' OR SAL like '%25/12%' OR Address like '%25/12%'
I get an error "Cannot perform 'Like' operation on System.Date or
System.Double . Is there a workaround on this. I want to do a wildcard search
and filter a set of rows irrespective of the datatype of the datacolumn
Iam expecting an output of the following to be listed in the datagridview
for the above output
Jane |25/12/1976 | 25000 | Parkview boulevard
Kate |25/12/1975 | 25000 | Parkview boulevard
Ron |25/12/1978 | 25000 | Parkview boulevard
Juane |25/12/1973 | 25000 | Parkview boulevard
Nick |25/12/1972 | 25000 | Parkview boulevard
Any help is very much appreciated |