Microsoft KB Archive/189201

= INFO: DFW Filter on Char Datatype Results in No Records Found =

Article ID: 189201

Article Last Modified on 3/7/2005

-

APPLIES TO


 * Microsoft Visual InterDev 1.0 Standard Edition
 * Microsoft Active Server Pages 4.0
 * Microsoft Internet Information Server 4.0
 * Microsoft Internet Information Services 5.0

-



This article was previously published under Q189201



SUMMARY
Using the Data Form Wizard with a field of char datatype can result in no records found when filtered. This happens when the string used to filter is not the exact length specified for the char datatype field in the SQL Server table.

With SQL Server, a char datatype has a specific character length and every piece of data put into that field must have that length. If it does not have that length, it is in essence padded with trailing spaces to make it the specified length. On the other hand, the varchar datatype also has a specific character length, but it allows the contents of the field to be less than or equal to that length.

When filtering in the Data Form Wizard the filter value is truncated of all leading or trailing spaces and therefore if it contains fewer characters than the specified char type length, no matches will be found. By changing the datatype of the field to varchar the same filter will return records.



MORE INFORMATION
The easiest way to change the datatype of a field on SQL Server is through the Visual InterDev Visual Data Tools. Use the following steps to change a datatype with Visual Data Tools.

These steps assume the user has a Web project with a data connection open in Visual InterDev:


 * 1) Go to the Data View tab.
 * 2) Expand a SQL Server data connection to the desired table.
 * 3) Right-click the table and select "Design."
 * 4) Click the datatype column of the desired field and select and datatype from the drop-down list.
 * 5) Save the table by clicking on the "single disk" icon, pressing Ctrl-S, or click Save from the File menu.

Keywords: kbinfo kbdatabase KB189201

-

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

© Microsoft Corporation. All rights reserved.