Click here to Skip to main content
15,881,455 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Friends,
I need an Advanced search in .aspx page with one dropdown combobox for gender selection
and one for Age range (From age, To age) and one for Class(class 1 to 12) and one for Section(A,B,C) So altogether there are 5 dropdown combobox. The result will be displayed in Gridview. I need a very simple code in c# .aspx in sql server 2008. I DONT WANT stored procedure or LINQ to SQL Classes please.
Kindly give a reference link or source code similar to my requirement.
Thank you and please help.

What I have tried:

I just designed .aspx page - nothing fashion and waiting for help from you for code behind.
Posted
Updated 15-May-21 3:46am

As far as I can see if you select something from a combo box, then you would generate corresponding condition into your SQL statement.

For example if your initial SQL looks like
SQL
SELECT ...
FROM MyTable mt
WHERE ...

Now when something from the age combo is selected you would add corresponding condition
SQL
AND Age = @SelectedAge

In your code you would also add definition for the parameter as described in SqlParameter Class (System.Data.SqlClient) | Microsoft Docs[^]

So in brief you dynamically add conditions and their parameters when user select something from the comboboxes.

One thing to notice is that SQL Server 2008 is no longer supported so you should use a newer version. See End support SQL Server 2008 R2 (KB 4456242) - SQL Server | Microsoft Docs[^]
 
Share this answer
 
v2
Comments
ravitv 15-May-21 11:49am    
Great thanks,
I believe the link would give me some ray of hope to solve my problem.
Thanks Wendelius.
Wendelius 15-May-21 13:07pm    
You're most welcome!
Sorry, you misunderstand the purpose of this forum. It is for answering technical questions, not for doing other people's work.
 
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