how to use Filter on Dataview string like te*xt%
-
Hello Everybody, Can someone help in finding solution for dataview filter I know how to use dataview filter and I had been using dataview for my application for biding 5 gridview. Every gridview is binded by dataview. And when I'm using filter by sending filter criteria using textbox, it is possible to send any kind of string to filter the dataview. Now problem is when I send string like 1) *text, it works fine 2) text*, it works fine 3) te*xt, it fails why this is so? Can someone please help me in this regard :) Solution on this will be appreciated :rolleyes: Regards Balasaheb Kahat
-
Hello Everybody, Can someone help in finding solution for dataview filter I know how to use dataview filter and I had been using dataview for my application for biding 5 gridview. Every gridview is binded by dataview. And when I'm using filter by sending filter criteria using textbox, it is possible to send any kind of string to filter the dataview. Now problem is when I send string like 1) *text, it works fine 2) text*, it works fine 3) te*xt, it fails why this is so? Can someone please help me in this regard :) Solution on this will be appreciated :rolleyes: Regards Balasaheb Kahat
WILDCARD CHARACTERS Both the * and % can be used interchangeably for wildcard characters in a LIKE comparison. If the string in a LIKE clause contains a * or %, those characters should be escaped in brackets ([]). If a bracket is in the clause, the bracket characters should be escaped in brackets (for example [[] or []]). A wildcard is allowed at the start and end of a pattern, or at the end of a pattern, or at the start of a pattern. For example: "ItemName LIKE '*product*'" "ItemName LIKE '*product'" "ItemName LIKE 'product*'" Wildcard characters are not allowed in the middle of a string. For example, 'te*xt' is not allowed. for more info ============= http://msdn2.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx[^]
Regards, Sylvester G Senior Software Engineer Xoriant Solutions sylvester_g_m@yahoo.com
-
WILDCARD CHARACTERS Both the * and % can be used interchangeably for wildcard characters in a LIKE comparison. If the string in a LIKE clause contains a * or %, those characters should be escaped in brackets ([]). If a bracket is in the clause, the bracket characters should be escaped in brackets (for example [[] or []]). A wildcard is allowed at the start and end of a pattern, or at the end of a pattern, or at the start of a pattern. For example: "ItemName LIKE '*product*'" "ItemName LIKE '*product'" "ItemName LIKE 'product*'" Wildcard characters are not allowed in the middle of a string. For example, 'te*xt' is not allowed. for more info ============= http://msdn2.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx[^]
Regards, Sylvester G Senior Software Engineer Xoriant Solutions sylvester_g_m@yahoo.com
-
put delimeter [ and ] programmatically RowFilter = "Name Like 'Sar[*]avanan'" this will give Names like 'Sar*avanan'
Regards, Sylvester G Senior Software Engineer Xoriant Solutions sylvester_g_m@yahoo.com
-
put delimeter [ and ] programmatically RowFilter = "Name Like 'Sar[*]avanan'" this will give Names like 'Sar*avanan'
Regards, Sylvester G Senior Software Engineer Xoriant Solutions sylvester_g_m@yahoo.com
Thanks for quick & useful reply I have tried ur code doesn't give expected answer. Explaination:- RowFilter = "Name Like 'Sar[*]avanan'" Suppose Name contains like "Sareeavan", the above doesn't return "Sareeavan" as result, but returns blank I have a column named "ref" which contains records like 0007k, 0017,0127, I like find out records such as starting with 0*7 search criteria (This should min return 0007k, but wont). As per logic 0*7 should return all above values as result. RowFilter doesn't work on such criteria, do u have any solution on such criteria? Regads,
Balasaheb Software Developer Platform: Asp.net,vb.net Database: SQL Server 2000
-
Thanks for quick & useful reply I have tried ur code doesn't give expected answer. Explaination:- RowFilter = "Name Like 'Sar[*]avanan'" Suppose Name contains like "Sareeavan", the above doesn't return "Sareeavan" as result, but returns blank I have a column named "ref" which contains records like 0007k, 0017,0127, I like find out records such as starting with 0*7 search criteria (This should min return 0007k, but wont). As per logic 0*7 should return all above values as result. RowFilter doesn't work on such criteria, do u have any solution on such criteria? Regads,
Balasaheb Software Developer Platform: Asp.net,vb.net Database: SQL Server 2000
you misunderstood that. We can not do any pattern like 'te*xt' . If you want escape the character * from users input. we need to use delimeter [ and ] to remove compilation errors.
Regards, Sylvester G Senior Software Engineer Xoriant Solutions sylvester_g_m@yahoo.com
-
you misunderstood that. We can not do any pattern like 'te*xt' . If you want escape the character * from users input. we need to use delimeter [ and ] to remove compilation errors.
Regards, Sylvester G Senior Software Engineer Xoriant Solutions sylvester_g_m@yahoo.com
Thanks for ur reply Finally conclusion is Dataview can not filter string starting with 00*7, we have to do some other solution, is it correct? otherwise I have to query to database for filter criteria of such requirement. What I was doing earlier Retreiving data from database and keep it in cache[20 mins] For every postback on same page, dataset is fill with this cache data. Then this ds is converted into dataview in order to filter the record. Postback happen when 1) on button click Filter, 2) ShowAll button Click 3) Paging 4) Sorting Regards
Balasaheb Software Developer Platform: Asp.net,vb.net Database: SQL Server 2000
-
Thanks for ur reply Finally conclusion is Dataview can not filter string starting with 00*7, we have to do some other solution, is it correct? otherwise I have to query to database for filter criteria of such requirement. What I was doing earlier Retreiving data from database and keep it in cache[20 mins] For every postback on same page, dataset is fill with this cache data. Then this ds is converted into dataview in order to filter the record. Postback happen when 1) on button click Filter, 2) ShowAll button Click 3) Paging 4) Sorting Regards
Balasaheb Software Developer Platform: Asp.net,vb.net Database: SQL Server 2000
Yes. You should handle this kind of pattern in Database query or Do it manually. You can not get advantage from RowFilter for this sort of patterns
Regards, Sylvester G Senior Software Engineer Xoriant Solutions sylvester_g_m@yahoo.com