Solve data source refresh issues for GRID in VFP

xiaoxiao2021-03-06  76

Solve data source refresh issues for GRID in VFP

---- VFP table control Grid is a good display query, editing data control, but will encounter the following questions in use:

---- 1, use the Select-SQL statement, a temporary table, or a representation of the Grid as a RECORDSource property of the Grid, the GRID control often does not display data, or the original Grid when selectsource at the GRID. Attributes include column and column header properties are all lost, restore to GRID default properties.

---- 2, when using the pack command to completely delete some records in the table, the result is often a blank of Grid, and what is displayed.

---- Many people feel puzzled. Some people think that the GRID will save the form to solve such problems, which is more troublesome. In fact, there is a very simple way to solve a series of data source refresh questions about Grid:

---- Before changing the Grid or execute the pack command, set the Grid's RecordSource property into null, then perform the corresponding SELECT-SQL statement, change the table alias or pack command, for example

1> thisform.grid1.recordsource = NULL

Pack

thisform.grid1.Recordsource = 'TableName'

&& restore original table alias

2> thisform.grid1.Recordsource = NULL

thisform.grid1.recordsource = 'NewTableName'

&& changes alias

3> thisform.grid1.recordsource = NULL

Thisform.grid1.Recordsource = 'SELECT Column1,

Column2 from tablename where column1 = trisform.

Text1.Value Into Cursor Temptable '

thisform.grid1.Recordsource = 'Temptable'

---- This Grid not only shows the changes after the changed data, but its properties will not be lost.

转载请注明原文地址:https://www.9cbs.com/read-122863.html

New Post(0)