Dim sql As String = "SELECT * FROM People WHERE DATEPART(month, dtime) = '" & _
DateTime.Month & "' & DATEPART(year, dtime) = '" & DateTime.Year & '"
Dim Sqlreader As SqlCeDataReader = cmd.ExecuteReader
The error I get is:
There was an error parsing the query. [ Token line number = 1,Token line offset = 82,Token in error = = ]
It doesn't seem to recognize the second DATEPART search and the = sign is a syntax error.
What am I doing wrong here?
in the "& DATEPART(year, dtime)" part, replace "&" with "and"
regards
|||Hmmm, I tried the '&' symbol and also tried 'AND' but not a lowercase 'and'.Thanks.
crt
No comments:
Post a Comment