Microsoft KB Archive/58020

= Cannot Search on Blank String Field in VB for MS-DOS ISAM =

Article ID: 58020

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft Visual Basic for MS-DOS
 * Microsoft BASIC Professional Development System 7.0

-



This article was previously published under Q58020



SUMMARY
Blank string fields cannot be searched on with the ISAM file handler that comes with the Professional Edition of Microsoft Visual Basic for MS-DOS, version 1.0; or Microsoft Basic Professional Development System (PDS) for MS-DOS, version 7.0.

The information in this article is also included with the Help file provided with the Professional Edition of Microsoft Visual Basic for MS-DOS, version 1.0.

If a search is performed on a string field (whether the field is the entire index or part of a combined one) and the entire field is filled with spaces, the record will not be found and an end-of-file condition will be returned.

To work around this problem, represent blank fields by inserting some other character into them and searching on the presence of that character in the field.



MORE INFORMATION
Due to the way the ISAM engine stores string fields in a database table, completely blank string fields cannot be found when you use the SEEKGT, SEEKGE, or SEEKEQ statements. This is the case whether the string field represents the entire index or whether it is a field (primary or not) included in a combined index. Also, the same behavior is exhibited with fields that are unique and with those that have duplicates.

This characteristic of the ISAM file handler is due to the way it strips off leading and trailing spaces from a string field to conserve disk space. For example, if the string &quot; abc &quot; (length of 5, with one leading and one trailing space) is inserted into a string field with a length of 10, &quot;abc&quot; (a length of 3) is actually written to the table. Therefore, inserting a string consisting entirely of spaces results in nothing being written to the table because every character is stripped off.

The best workaround for this situation is to associate a special character with string fields that are to be completely blank and set the field equal to that character. Then, in all subsequent searches on this field, use that character as the key.

Additional query words: VBmsdos BasicCom 1.00 7.00

Keywords: KB58020

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.