Data Conversion and Validation
page 4 of 7
by Brian Mains
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 5532/ 237

String Ranges

Strings in the .NET Framework support a wide array of character sets and languages. This is good because SQL Server can support different languages and cultures. However, the .NET Framework does not validate the requirement on the length of the stringĀ  This means that even though the length of a field in SQL Server is 50 characters long, the .NET Framework string type cannot be limited by that.

It is important to validate the lengths of strings before passing them to the database. This can be troublesome because the error message that returns to the caller is usually not specific enough to identify the specific field over the limit, and it becomes a harder task to identify the data in error.

The UI controls in .NET allow restrictions on the lengths of strings by entering in a maximum limit. A check on the server side can be done as well; though hard-coding a string length can make it difficult to maintain an application (because any changes to the database affect the UI).


View Entire Article

Article Feedback

Title:  
Name:  
Url: ( Optional )
Comment:  
Please add 6 and 3 and type the answer here:

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 
Learn More
.NET Tools
asp.net shopping cart
asp.net chart control






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2008 ASPAlliance.com  |  Page Processed at 12/2/2008 10:27:29 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search