Parameters: How to use them exactly
Posted: Mon Jul 19, 2010 3:58 am
Hi,
I have been browsing the forum since the beginning of this morning, trying to find examples on how to implement parameters in the correct way.
What's troubling me is how I'm going to code my project with these ideas.
Sometimes the parameters won't be used and all the data should be visible. On the other hand, there are the parameters depending on the request.
One person would like to view all data from just one place, for example, all persons from one city. And there is another who would like to see how all the men or women in the report.
For this only I would need 2 parameters. But what if 1 parameter does not get set. In the report designer (windows tool) I get an exception because a parameter is not set.
Example:
I have a query: SELECT * FROM persons WHERE Gender = @Gender AND City = @City
Now I would like to see only the persons in a specific city.. But the report requires 2 parameters. I prefer to work with named parameters.
I hope you understand what my intentions are.
Thank you in advance.
I have been browsing the forum since the beginning of this morning, trying to find examples on how to implement parameters in the correct way.
What's troubling me is how I'm going to code my project with these ideas.
Sometimes the parameters won't be used and all the data should be visible. On the other hand, there are the parameters depending on the request.
One person would like to view all data from just one place, for example, all persons from one city. And there is another who would like to see how all the men or women in the report.
For this only I would need 2 parameters. But what if 1 parameter does not get set. In the report designer (windows tool) I get an exception because a parameter is not set.
Example:
I have a query: SELECT * FROM persons WHERE Gender = @Gender AND City = @City
Now I would like to see only the persons in a specific city.. But the report requires 2 parameters. I prefer to work with named parameters.
I hope you understand what my intentions are.
Thank you in advance.