Click here to Skip to main content
Sign Up to vote bad
good
See more: ASP.NETVB.NET
Hello All,
 
I am applying filtering in DevExpress AspxGridView.
For filtering I'm sending the values for filtering from code side and filtering the records in sql server 2005 by these values.
 
Now my requirement is that the user can select any values for filtering means suppose I have 7 controls for giving option to user to filter then user is free to select any of controls to filter database according to selected values.
 
Now the problem is occurring when I use And statement in my where clause in stored procedure, it's not displaying any field because it filtered if all number of parameter values are sent.
And if I use Or in Where clause then it's displayed all values and not filtered according to selected values.
 
Can anyone suggest me how can I solve this issue.
 
Thanks in Advance.
 
Regards,
Posted 29-Jan-13 3:22am


1 solution

Based on what you have shared, one of the ways to handle string values is to use LIKE keyword along with wild card character %.
 
SELECT 
 *
FROM
  myTable
WHERE
  colName LIKE '%somevalue%'
Like this, even if there is no value, everything will be selected.
  Permalink  
Comments
Member 9207317 - 31-Jan-13 3:37am
Hello Sandeep Thanks for your great help.. Yes, the Like clause solved the issue, but I am sending multiple id's in the paramter, So it's not worked correctly with Like clause. Also I'm using a function which split the values: Suppose In parameter @p I have '1,2,3' Id's then my function is spliting these id's by @Split(@p,',') and worked well when I am applying this with "In ( Select * from split(@p,',')). Please let me know how can use the Like clause also by using this function. Thanks in Advance. Regards,

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Christian Graus 538
1 Ron Beyer 286
2 samadhan_kshirsagar 229
3 Tadit Dash 213
4 OriginalGriff 198
0 Sergey Alexandrovich Kryukov 7,017
1 Prasad_Kulkarni 3,815
2 OriginalGriff 3,557
3 _Amy 3,372
4 CPallini 3,010


Advertise | Privacy | Mobile
Web01 | 2.6.130619.1 | Last Updated 29 Jan 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid