Posted on: 5/8/2015 11:41:45 AM | Views : 635

Hi, all
I have a sql table on that storing my all the records and on that I have a date_column to store date information. for that date I'm using string datatype (varchar) and date format is 'dd-MM-yyyy'
my question is how to get all the records of a complete month from given date that is selected by the user. my query is: like this
strCommand = "select * from tblTimings where DAY(EnterDate) = DAY('" + searchDate + "') AND YEAR(EnterDate) = YEAR('" + searchDate + "')"; and resulted query is like this: -
select * from tblTimings where DAY(EnterDate) = DAY('07-04-2015') AND YEAR(EnterDate) = YEAR('07-04-2015') when my date is less then '12-__-____' works fine but when date is greater then 12 i.e. '13-__-____' that displays an error 
error: -   Conversion failed when converting date and/or time from character string.

Go to the complete details ...