Microsoft Knowledge Base Email Alertz

(189201) - 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,...

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 189201 - Last Review: March 7, 2005 - Revision: 4.2

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

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.

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
Keywords: 
kbdatabase kbinfo KB189201
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate