Microsoft KB Archive/174584: Difference between revisions
(importing KB archive) |
m (Text replacement - """ to """) |
||
Line 63: | Line 63: | ||
For example if you wanted to find all the records that have CA for the region field, use the following code:</p> | For example if you wanted to find all the records that have CA for the region field, use the following code:</p> | ||
<pre class="codesample"> SET ORDER TO xregion | <pre class="codesample"> SET ORDER TO xregion | ||
SET KEY TO | SET KEY TO "CA" | ||
</pre> | </pre> | ||
<p>This is assuming that there is a index tag on the region field called | <p>This is assuming that there is a index tag on the region field called "xregion."</p></li> | ||
<li><p>Use the NOFILTER clause in the SELECT-SQL statement to ensure that the cursor created will not be a filter. This clause is only valid in Visual FoxPro 5.0. In Visual FoxPro 3.0 you can add a | <li><p>Use the NOFILTER clause in the SELECT-SQL statement to ensure that the cursor created will not be a filter. This clause is only valid in Visual FoxPro 5.0. In Visual FoxPro 3.0 you can add a ".T." to the field list to prevent the filter. For example:</p> | ||
<pre class="codesample"> SELECT *,.t. FROM Customer WHERE country = | <pre class="codesample"> SELECT *,.t. FROM Customer WHERE country = "USA" INTO CURSOR test | ||
</pre></li></ol> | </pre></li></ol> | ||
Line 89: | Line 89: | ||
<li>Use a large table with more than 200,000 records.</li> | <li>Use a large table with more than 200,000 records.</li> | ||
<li><p>Create a simple SELECT-SQL statement such as the following:</p> | <li><p>Create a simple SELECT-SQL statement such as the following:</p> | ||
<pre class="codesample"> SELECT * FROM Customer WHERE country = | <pre class="codesample"> SELECT * FROM Customer WHERE country = "USA" INTO CURSOR test | ||
</pre></li> | </pre></li> | ||
<li>Create a form with a grid on it.</li> | <li>Create a form with a grid on it.</li> |
Latest revision as of 11:07, 21 July 2020
Article ID: 174584
Article Last Modified on 3/11/2005
APPLIES TO
- Microsoft Visual FoxPro 3.0 Standard Edition
- Microsoft Visual FoxPro 3.0b Standard Edition
- Microsoft Visual FoxPro 5.0 Standard Edition
- Microsoft Visual FoxPro 5.0a
- Microsoft Visual FoxPro 6.0 Professional Edition
This article was previously published under Q174584
SYMPTOMS
Scrolling in a grid might be slow if the RecordSource of the grid points to a cursor, which actually is a filter of the table.
RESOLUTION
Use the following steps to work around the problem:
Use the SET KEY TO command to filter the data instead of using a SELECT-SQL command.
For example if you wanted to find all the records that have CA for the region field, use the following code:SET ORDER TO xregion SET KEY TO "CA"
This is assuming that there is a index tag on the region field called "xregion."
Use the NOFILTER clause in the SELECT-SQL statement to ensure that the cursor created will not be a filter. This clause is only valid in Visual FoxPro 5.0. In Visual FoxPro 3.0 you can add a ".T." to the field list to prevent the filter. For example:
SELECT *,.t. FROM Customer WHERE country = "USA" INTO CURSOR test
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.
MORE INFORMATION
This problem occurs only with cursors created with the SQL SELECT command. A local view will not create a filtered cursor.
Steps to Reproduce Behavior
- Use a large table with more than 200,000 records.
Create a simple SELECT-SQL statement such as the following:
SELECT * FROM Customer WHERE country = "USA" INTO CURSOR test
- Create a form with a grid on it.
- Set the RecordSource property of the grid to the cursor test.
- Run the form.
- Drag the scroll button of the grid all the way to the bottom.
The grid takes a long time to refresh. The larger the table, the longer it will take.
(c) Microsoft Corporation 1997, All Rights Reserved. Contributions by David Botzenhart, Microsoft Corporation
Keywords: kbprb KB174584