Click here to Skip to main content
15,897,360 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hi,

I am working on search functionality module in which i have to pass parameters through query string.But the query string must be generated dynamically based on the options selected by the user. (like user may select platform=asp.net, programming language=c#,location=us etc..)

I have worked on static query string but not on generating string during run time.
It would be helpful for me if any friend help in achieving the above functionality.

Thanks,

Vasanth
Posted
Comments
Ankur\m/ 18-Apr-11 7:08am    
There are lots of examples available on the web. Try searching Google for "Dynamic QueryString" check out the links, filter the results as you need.

What is wrong with String.Format()[^]?
 
Share this answer
 
How about using a combination of switch()[^] and StringBuilder[^]?
 
Share this answer
 
try this

SQL
create dynamic query like that
and pass one parameter to database
Collapse
if (InterviewCategoryId == 0)
           {
               if (DateTo == "" && SearchByName == "" && DateFrom != "")
               {
                   Query += " ";
               }
               else if (DateTo != "" && DateFrom == "" && SearchByName == "")
               {
                   Query += " ";
               }
               else if (DateTo == "" && DateFrom == "" && SearchByName != "")
               {
                   Query += " ";
               }
               else if (DateTo != "" && DateFrom != "" && SearchByName != "")
               {
                   Query += "";
               }
               else
               {
                   Query += "";
               }

pass it to the DataBase as one Parameter;
Obj.fn_GetSearcgCandidatesResult(Query);
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900