fields and properties for datetime

Posted by Sreekanthv5 under ASP.NET on 9/6/2011 | Points: 10 | Views : 625 | Status : [Member] | Replies : 1
DateTime _hiredate;
public DateTime? hiredate
{
get
{
return _hiredate;
}
set
{
_hiredate = value;
}
}

Error 1 Cannot implicitly convert type 'System.DateTime?' to 'System.DateTime'. An explicit conversion exists (are you missing a cast?) E:\aspnet\comp\Business Object\company.cs 64 29 Business Object

i am getting conversion problem please help me

thanq.




Responses

Posted by: Niladri.biswas on: 9/7/2011 [Member] Platinum | Points: 25

Up
0
Down
Change the Setter as

set
{
_hiredate = Convert.ToDateTime(value);
}

hope this helps

Best Regards,
Niladri Biswas

Sreekanthv5, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response