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): 32726/ 119

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

User Comments

Title: good   
Name: jay
Date: 2010-01-29 1:45:56 AM
Comment:
good article.. but confusing words....






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


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-10-08 7:53:59 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search