Hi,
I have a database that stores dates broken into int's. I.e. Day, Month and Year are stored separately in different columns.
In existing SQL queries, the method used is:
DATEADD(dd, - 1, DATEADD(mm, Z.LastMonth, DATEADD(yy, Z.LastYear - 1900, 0))) AS last_date
I cannot change the database to store dates instead.
Looking further into the dateadd() function, it's converting from an integer (0). Linq to SQL does not have a similar functionality i.e. Convert.ToDateTime(0). That results in an InvalidCastException.
I have tried concatenating strings to create a date, but it is WAYYYYY tooooo sllloowww. the time difference was about 10 minutes.
What else can I do? I don't particularly want to start mixing in SQL queries into the project either.
Thanks.