Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • your information helped be complete my task. i have worked on this for more than 10 hours and non of the answers would work for me. When i concatenate like you have shown my project works great. but the rule seems to be to not write a SQL statement like this. when ever i try to set the SqlCommand's to add the date parameters to the SQL statement the parameters will not attach and i get the error that i must declare "@startDate" and "@endDate". i can not get passed this issue. I tried your date format "dd MMM yyyy" which worked and i also tried "yyyy MMM dd" which also performed the same. Commented Mar 13, 2020 at 3:49
  • Great it helped! Above are code samples. It's always better to declare and use parameters to avoid SQL Injection. And it seems you are already required/protected by the rules in your project, which is good. Commented Mar 14, 2020 at 18:34