A
acko bogicevic
Hi everybody
On page i have text box txtDate. User writes date in dd.mm.yyyy format.
When the button btnSearch is clicked i have to query sqlserver 2000
database. Here is a code:
Private Sub btnSearch_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnSearch.Click
...
If Trim(txtDate.Text) <> "" Then
Dim dCreatedFrom As Date
Try
dCreatedFrom = CDate(Trim(txtDate.Text))
Catch ex As Exception
Response.Redirect("GlobalError.aspx")
End Try
strSQL =" Select * from Orders Where OrderDate >= '" &
Format(dCreatedFrom, "YYYY.MM.DD") & "'"
End If
End Sub
When i return dataset with this strSQL i always get the error:
Syntax error converting datetime from character string
How can i solve this
Thanks
Alex
On page i have text box txtDate. User writes date in dd.mm.yyyy format.
When the button btnSearch is clicked i have to query sqlserver 2000
database. Here is a code:
Private Sub btnSearch_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnSearch.Click
...
If Trim(txtDate.Text) <> "" Then
Dim dCreatedFrom As Date
Try
dCreatedFrom = CDate(Trim(txtDate.Text))
Catch ex As Exception
Response.Redirect("GlobalError.aspx")
End Try
strSQL =" Select * from Orders Where OrderDate >= '" &
Format(dCreatedFrom, "YYYY.MM.DD") & "'"
End If
End Sub
When i return dataset with this strSQL i always get the error:
Syntax error converting datetime from character string
How can i solve this
Thanks
Alex