Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parametrized view
Message
From
29/10/2004 05:53:54
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 6
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00955225
Message ID:
00955714
Views:
15
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
Map
View

Click here to load this message in the networking platform