General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Network:
Windows 2000 Server
Hi Borislav,
VFP does support Between syntax, otherwise the view wouldn't work if called from a VFP app, which does work:
datefirst={^2004-01-01}
datelast={^2004-06-30}
select * from myview
This returns all records for the 1st 1/2 year.
If I try something like this:
locommand=CREATEOBJECT("adodb.command")
locommand.ActiveConnection =objconn
locommand.CommandText
locommand.CommandText='select * from myview'
lopar=CREATEOBJECT("adodb.parameter")
lopar.Name
lopar.Name='datefirst'
lopar.Type= 129 && adChar
lopar.Direction = 1
lopar.Size=8
lopar.Value='20030901'
lopar2=CREATEOBJECT("adodb.parameter")
lopar2.Name='datelast'
lopar2.Type= 129 && adChar
lopar2.Direction = 1
lopar2.Size=8
lopar2.Value='20030930'
locommand.Parameters.Append (lopar)
locommand.Parameters.Append (lopar2)
locommand.Execute
This will generate a 'variable datefirst is not found' error.
I don't think VFP support BETWEEN ... and ...
Try this:
create view myview as select * from mytable where BETWEEN(date_booked, ?datefirst,?datelast)
>Hi,
>
>I have create a parametrized view in my vfp database, something like:
>create view myview as select * from mytable where date_booked between ?datefirst and ?datelast.
>
>I tried to retrieve the records from this view through OLEDB by using parameter objects with names datefirst and datelast, but the query keeps saying that 'variable datefirst is not found'. Am I doing something wrong or is it just not possible to do this?
>
>Thanks,
>
>Auke
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only