Conversion failed when converting the varchar value xxx to data type int error
- by zurna
I need to take data between certain dates. But I get the following error.
AdsDateStarted : 03/18/2010 01:51:38.000 AM
AdsDateENded : 09/13/2010 05:00:00.000 PM
formatdate function converts today's date to 3/22/2010 format.
SQL = "SELECT * FROM Ads"
SQL = SQL & " WHERE AdsActive = 1 AND AdsAreasID = "& rtt &" AND CONVERT(VARCHAR(10), AdsDateStarted, 101) <= "& formatdate(Date()) &" AND CONVERT(VARCHAR(10), AdsDateEnded, 101) >= "& formatdate(Date()) &""
Set kdFonksiyon = objConn.Execute(SQL)