Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to use IN clause in VFP
Message
 
To
29/01/2002 11:22:30
Lakhani Anil
Lakhani Software Solutions
Mumbai, India
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00609547
Message ID:
00612234
Views:
34
What you are trying to do is one of the problems with the view designer. However it is possible to create a view through code that will do want you want.
Here is a simple example that will work.


* Create the view with the parameterized string
CREATE SQL VIEW "MyView" ;
AS SELECT * FROM temp!item WHERE item IN (&?lcString)


* Now to run the view
* Concat all indiviual parameters as a string
lcString = "'00002','00003','00009'"

USE MyView
SELECT MyView
BROWSE

The downside to this approach is that when you try to modify the view in the view designer, you get a Syntax Error. This is the reason why we don't use view designer, instead we create all database objects through code and save the code as part of the project. If we need to modify the view, then we can modify it in the code and recreate the view.

Hope this helps.
Previous
Reply
Map
View

Click here to load this message in the networking platform