How to do implement a wild card search on a Data Set  
Author Message
Adithya





PostPosted: .NET Framework Data Access and Storage, How to do implement a wild card search on a Data Set Top

I need some help to implement a wild card search on data set that retrieves cached data

.NET Development37  
 
 
Bappi





PostPosted: .NET Framework Data Access and Storage, How to do implement a wild card search on a Data Set Top

u can use DataTable Select method to perform this

DataRow[] dr = DataSet1.Tables[0].Select ("Name Like '%ab'");

or u can use DataView.

DataView dv = DataSet1.Tables[0].DefaultView;

dv.RowFilter = "Name Like '%ab%'";



 
 
Adithya





PostPosted: .NET Framework Data Access and Storage, How to do implement a wild card search on a Data Set Top

I am not able to implement a wild card search of type A%a where i want to specify the first and last characters. It gives me an invalid expression error.
 
 
Bappi





PostPosted: .NET Framework Data Access and Storage, How to do implement a wild card search on a Data Set Top

A%a is not allowed in filter expressions. Check MSDN for more details. What you can do is set the filter expression like this

"Name Like 'A%' AND Name Like '%a'"

Try this hopefully this will work.