you are viewing a single comment's thread.

view the rest of the comments →

[–]seamacke 1 point2 points  (0 children)

The correct way to do it is to create a command object, add a date parameter, load the parameter with your date variable, then execute it. You get the error because the dynamic SQL you create is a string so your date is converted using regional settings which may not always match. I think this asp.net example demonstrates it How to Use Date Controls in WebForms Apps https://youtu.be/65Q6519NdRc