Article ID: 130707
Article Last Modified on 2/12/2007
SELECT <TableName>
SET FILTER TO status = 'Y'
CREATE SQL VIEW customer_data;
AS SELECT * FROM customer WHERE customer.country = ?cCountry
This example includes all records where the Country field in the
Customer table match the value in the cCountry memory variable. If
cCountry did not exist at the time the form was created, a dialog box
would appear asking for the value of cCountry. To use a parameterized
query as the source of data for the grid, set the RecordSource property
to 1 - Alias and the RecordSource property to the name of the view.
WITH thisform
.Caption="CursorAdapter and Grid Example"
.left=26
.width=582
.height=375
.autocenter=.t.
endwith
SET EXCLUSIVE OFF
SET MULTILOCKS ON
open database HOME()+"Samples\Data\"+"testdata"
PUBLIC ocursor as Cursoradapter, errorarray
ocursor=CREATEOBJECT('cursoradapter')
WITH ocursor
.alias="testcursor"
.datasourcetype = 'Native'
.Selectcmd="select * from products where unit_cost>20.00"
.tables="products"
IF .cursorfill()=.t.
thisform.grdCursor1.columncount=-1
thisform.grdCursor1.RecordSourcetype=1
thisform.grdCursor1.RecordSource="testcursor"
thisform.grdcursor1.Refresh
else
AERROR(errorarray)
MESSAGEBOX(errorarray[2])
ENDIF .cursorfill()
endwith
The grid displays all the records where the unit_cost is larger than $20. To change the SELECT-SQL command that returns the records, modify the Selectcmd property of the CursorAdapter object. 814184 How to update data by using the TableUpdate function with the CursorAdapter object
Additional query words: browse key
Keywords: kbdesigner kbhowto KB130707