Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parametrized Queries
Message
From
17/11/1998 23:30:21
 
 
To
17/11/1998 18:16:08
Marcelo Codino
Mystic & Faith - Sistemas -
Buenos Aires, Argentina
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00158551
Message ID:
00158618
Views:
10
>Can I create a parametrized query(ddateFrom-ddateTo) that drops their results in a ListBox or on another control ?
>
>Thanks in advance.

Yes.

You can do this in any of several ways. You can use straigh SQL, or a parameterized view defined in the database container.

A regular query would look like

ldBeginDate = {05/05/95}
ldEndDate = {07/07/1997}

SELECT Field1 ;
FROM myTable;
WHERE myTable.BeginDate = ldBeginDate;
AND myTable.EndDate = ldEndDate;
INTO CURSOR myCursor

THISFORM.EditBox1.RowSourceType = 1
THISFORM.EditBox1.RowSource = "myCursor"

With a view, you would define the view first with parameters in the WHERE clause
(WHERE EndDate = ?ldEndDate AND StartDate = ?ldStartDate)

Then, when you go to REQUERY the view, just fill the parameters and requery:

ldBeginDate = {05/05/95}
ldEndDate = {07/07/1997}

REQUERY('myView')

Grids, Listboxes and Comboboxes can all have cursors as their rowsource.
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform