No! This is the wrong way IMHO.
mDateVar = date(2008,6,1)
cSqlCommand = "select * from mytable where myDateTimeField >= ?m.mDateVar"
Cetin
>I found what I was missing. I have to convert the Date to DateTime for comparison. E.g.
>
>
>cSqlCommand = "select * from mytable where myDateTimeField >= ?'" + TTOC(DTOT( mDateVar )) + "'"
>
>
>>Good evening,
>>
>>I have run into a little issue with retrieving data from SQL Server using WHERE containing DATE. Obviously the SQL Server has the date in the DATETIME format. I want to create a string that will have WHERE to retrieve records within a date range. Here is a simple version of what I tried:
>>
>>
>>cSqlCommand = "select * from mytable where myDateTimeField >= ?06/01/2008"
>>
>>
>>But I don't get the records that I am supposed to get. That is, I get records where DATE portion of them is before 6/1/2008.
>>
>>What am I missing?
>>
>>Thank you in advance for any help.