Error converting datetime to string
        Posted  
        
            by user279521
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user279521
        
        
        
        Published on 2010-03-24T15:30:15Z
        Indexed on 
            2010/03/24
            15:33 UTC
        
        
        Read the original article
        Hit count: 336
        
asp.net-3.5
|c#3.5
Hi, I am getting an error when I attempt to display a datetime value in a textbox:
My code is:
txtStartDate.Text = rdrGetUserInfo.IsDBNull(14) ? String.Empty : Convert.ToString(rdrGetUserInfo.GetString(14));
The error message is: ex.Message = "Unable to cast object of type 'System.DateTime' to type 'System.String'."
Any ideas how I can resolve this?
© Stack Overflow or respective owner