I have two datetimepicker and one button I want sales of monthly or wahtever date selected in two datetimepickers
Below is my query:
ad2 = New SqlDataAdapter(
"select sum(amt) from TailorLedger where date between'" &
CDate(DateTimePicker1.Value.ToShortDateString) &
"' AND '" &
CDate(DateTimePicker2.Value.ToShortDateString) &
"'", con)
But on button press it shows following error:
The conversion of a varchar data type to a datetime data type resulted in an out-of-range value
Can anyone suggest the correct query?