AnsweredAssumed Answered

datetimepicker query dates in sql server

Question asked by 240robs on Feb 28, 2013
Latest reply on Mar 6, 2013 by 240robs
I have a form that has two datetimepicker's (From and To) I am trying to select dates from date time field.
If I manually select dates with whereClause = "InspectionDate > '2012-09-04 07:50:41'
AND InspectionDate < '2012-10-04 07:44:04'" it will work. If I pass the value from the date time picker it wants to reformat the date.
I have tried to re-format the date with Dim tDate As String = frmTech1.ToDatePicker.Value.ToString("yyyy-MM-dd") which works but I cannot query table with a string.
My where clause looks like this whereClause = "InspectionDate > " & vFrom & " " & "00:00:00" '& " " & "AND" & " " & "InspectionDate < " & vTo & " " & "00:00:00" & " " & "AND" & " " & "FieldTechnician" = "Tech" .

How do I convert this string format (yyyy-MM-dd) back to a date?


Cary Roberts , GISP
CVMVCD

Outcomes