I am using VFP for the database on a website that uses VBSCRIPT for its coding. I have a field in my
table that is type DATE. I want to find all records that are greater than today. I tried the following
commands as follows:
mySQL= (see examples below)
response.write mySQL
set eventSet=DBmiym.Execute(mySQL)
Here is what I tried
#1 FIRST TRY
mySQL="select * from event where sdate >= " & date()
#1 RETURNS:
select * from event where sdate >= 3/5/2001
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC Visual FoxPro Driver]Operator/operand type mismatch.
#2 ADDED POUND SIGNS
mySQL="select * from event where sdate >= #" & date() & "#"
#2 RETURNS:
select * from event where sdate >= #3/5/2001#
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Visual FoxPro Driver]Missing operand.
#3 HARD CODED DATE:
mySQL="select * from event where sdate >=#03/01/2001#"
#3 RETURNS:
select * from event where sdate >= #03/05/2001#
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Visual FoxPro Driver]Missing operand.
#4 HARD CODED WITHOUT POUND
mySQL="select * from event where sdate >= 03/05/2001"
#4 RETURNS:
select * from event where sdate >= 03/05/2001
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC Visual FoxPro Driver]Operator/operand type mismatch.
#5 WORKS, BUT DOESN'T SOLVE PROBLEM
mySQL="select * from event where sdate >= date()"
I believe # 5 works because it uses a command inherent with a sql statement internally. But what happens
when I need to look for something other than today, a field that was entered will say on the a form. One
of these should work somehow, shouldn't it?
Peter Brama
West Pointe Enterprises
VFP is getting easier but STILL alot to learn!!