c# Column datatype Date type (NOT DateTime)

Posted by Sha Le on Stack Overflow See other posts from Stack Overflow or by Sha Le
Published on 2010-04-15T14:52:55Z Indexed on 2010/04/15 15:13 UTC
Read the original article Hit count: 171

Filed under:
|

Hi All:

I want know is there good way to detect Column DataType for Date field (NOT DateTime)?

This what currently I do:


switch (dt.Columns[col].DataType.FullName)
{  
    case "System.DateTime":  
        formatedVal = Formatter.GetDateTime(val);  
        break;

    // which is NOT possible, but something equivalent am looking for
    case "System.Date":  
        formatedVal = Formatter.GetDate(val);  
        break;

    default:
        formatedVal = val.ToString();
        break;
}

Thanks a bunch. :-)

© Stack Overflow or respective owner

Related posts about c#

Related posts about sql