Reputation: 27
I am using vs 2010 and in my project. First I am retrieved data using sqladapter into dataset and then on the basis of requirement I retrieve and display. But when I am going to retrieve a data using following line:
ds.Tables(0).DefaultView.RowFilter = "name like '_n%'"
DataGridView1.DataSource = ds.Tables(0).DefaultView
I will not work. That is I want to retrieve only those rows whose name having second character as n. Can any one tell me what is the problem that is as a result it is not working? Also, I want to know that how to use textbox instead of constant value.
Upvotes: 0
Views: 3772
Reputation: 126
Underscore isn't working in the DataView filter expression. In fact only % and * wildcards are allowed: http://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression(v=vs.100).aspx
Perhaps you could use something like:
ds.Tables(0).DefaultView.RowFilter = "substring(name,2,1) = 'n'"
Upvotes: 4