I am using VFP 6.0 as a front end and SQL Server 2000 as a back end, with SQL passthru. I want to allow the user the ability to enter a date range in the format of 01/01/01 as an example. The SQL Server fields are of type DateTime. The following code works but seems like a bandage. Is there a “better” or different way to do this?
An example of code follows:
local ldBeginDate, ldEndDate
ldBeginDate = Thisform.txtBeginDate.Value
ldEndDate = Thisform.txtEndDate.Value
ldBeginDate = ldBeginDate + " 00:00:00 AM"
ldEndDate = ldEndDate + " 12:59:59 PM"
SQLEXEC(tConnection, 'SELECT * FROM LineCall ;
where datecreated >= ?ldBeginDate ;
and datecreated <= ?ldEndDate ', 'cuLineCall')
Thank you for any suggestions.