Try this :
dtpEqualTo.Value.ToString("yyyy-MM-dd")
Jx_Man
Nearly a Senior Poster
3,329 posts since Nov 2007
Reputation Points: 1,372
Solved Threads: 444
I've seen this error when the date passed as criteria is not in the same format as the server expects (SQL profile with regional settings MM-DD-YYYY and client passing date with format DD-MM-YYYY).
Try to SET DATEFORMAT DMY (replace DMY with the appropriate format as you datetimepicker's format) in the same command, just before your select, like this:
If TodayToolStripMenuItem.Checked = True Then
query = "SET DATEFORMAT DMY Select * from INCIDENTS where DateReported='" & dtpEqualTo.Value.Date & "'"
PS: If I remember correctly the DATEFORMAT will be persistent for the session until changed or connection is closed.
adam_k
Practically a Posting Shark
803 posts since Jun 2011
Reputation Points: 256
Solved Threads: 149