Solved

Format a ssn column in gridview.

Posted on 2007-03-27
2
559 Views
Last Modified: 2013-11-26
I am trying to format a ssn filed like 123456789  to 123-45-6789 in gridview.
Please help.
Thanks.
0
Comment
Question by:LuckyCold
2 Comments
 
LVL 15

Accepted Solution

by:
crisco96 earned 500 total points
Comment Utility
The easiest way is to modify your sql to include the formatting:

select substring(ssn, 1, 3) + '-' + substring(ssn, 4, 2) + '-' + substring(ssn, 6, 4) as SSN
from sometable
0
 

Author Comment

by:LuckyCold
Comment Utility
it works thank  you
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now