Answered by:
The WHERE selectCommand with two DDL selected values of the SqlDataSouirce did not work, can not open the FormView control.

Question
-
User-830563764 posted
In a VS2010 ASP.NET 4 webpage, I have had 2 DDL's to select an ID and a County.
The SqlDataSource with selectCommand WHERE ID=@ID or County = @COUNTY
worked fine respectively.
However, when I added both together in the SqlDataSource as ID=@ID and
County = @COUNTY, the FormView control was not displayed. Clicking the
DDL's did not open up the FormView control.
Why?
Friday, June 3, 2016 8:51 PM
Answers
-
User-1780421697 posted
I think when things are getting complicated then you need to use some sort of stored procedure or custom made ad-hoc query or what so ever you like which make the code easier in long terms and maintenance will be easy.
Take parameters from any number of ddls and pass to your stored procedure and populate control accordingly you need to manage events by yourself.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Saturday, June 4, 2016 10:28 AM -
User36583972 posted
Hi wonjartran,
I suggest you can check your problem as the following options.
1: Check your sql query returns the correct value. In database sql query editor, you can check your sql query.
2: Debug your code (DDL click event) and find whether a mistake in your program
3: You could also share us more relevant code to help us reproduce the problem.
Best Regards,
Yohann Lu
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, June 6, 2016 8:51 AM
All replies
-
User-1780421697 posted
I think when things are getting complicated then you need to use some sort of stored procedure or custom made ad-hoc query or what so ever you like which make the code easier in long terms and maintenance will be easy.
Take parameters from any number of ddls and pass to your stored procedure and populate control accordingly you need to manage events by yourself.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Saturday, June 4, 2016 10:28 AM -
User36583972 posted
Hi wonjartran,
I suggest you can check your problem as the following options.
1: Check your sql query returns the correct value. In database sql query editor, you can check your sql query.
2: Debug your code (DDL click event) and find whether a mistake in your program
3: You could also share us more relevant code to help us reproduce the problem.
Best Regards,
Yohann Lu
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, June 6, 2016 8:51 AM -
User-830563764 posted
I think it is very possible that there is no data can be selected for the both WHERE commands.
Monday, June 6, 2016 2:54 PM -
User36583972 posted
Hi wonjartran,
I think it is very possible that there is no data can be selected for the both WHERE commands.In database sql query editor, you can check your sql query. Then, adjust your statement or design logic. We can debug step by step to find which reason cause the error.
Best Regards,
Yohann Lu
Friday, June 10, 2016 6:04 AM