Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using SQL Select Command to Populate a Grid
Message
From
16/05/1996 13:20:46
 
 
To
15/05/1996 12:44:29
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00001348
Message ID:
00001386
Views:
40
These settings should work:
Grid.RecordSourceType="Alias"
Grid.RecordSource="schedule"
Grid.Column1.ControlSource=field1
Grid.Column2.ControlSource=field2
etc.
Of course, replace "field1, etc" with the field name.

If the query is to be user defined, at least as far as the where clauses are concerned, you might consider defining a parameterized view. When you define a view in your DBC you can use it like any table. I have a par.view named partlist and a grid displaying it. In the load method of the form I entered:
USE partlist IN 0 NODATA
This allows the grid to find its RecordSource yet nothing displays until the user defines the where clause input and clicks a button to requery the view. The below code shows the action of the click event. cQueryMask is the variable listed in the Example field of the Parameterized View. When defining the view, in the selection criteria my clause is:
Parts.Part_no like ?cQueryMask

txtQueryMask is a textbox for the user to enter the match desired. The percent sign is a wild card.
Hope this helps!
Mike Haake

EXAMPLE CODE:
cQueryMask = ALLTRIM(thisform.txtQueryMask.Value)
IF EMPTY(cQueryMask)
cQueryMask = "%"
ELSE
cQueryMask = cQueryMask +"%"
ENDIF
=requery("partlist")
THISFORM.GRID1.REFRESH()
RETURN
* code by mph
Michael P. Haake
FoxPro Programmer
"Doing the best I can!"
** Retired Air Force **
Previous
Reply
Map
View

Click here to load this message in the networking platform