Last post Sep 08, 2010 01:17 AM by kalpatel
Aug 25, 2010 01:05 PM|boehmap|LINK
I have a dynamic data site that stores Event data using LINQ-to-SQL. When someone requests an event, it is first stored as a PendingEvent (which is a child of Event) with a column/attribute called receivedAt, which is [ReadOnly(true)] and which is assigned
in InsertEvent as shown.
partial void InsertEvent(Event instance)
instance.requestedAt = DateTime.Now;
This works fine. The event displays with the correct receivedAt date, and it's correct in my database. It shows up just fine on my Display, Edit, and List pages. However, if I try to delete, the receivedAt in the instance (retrieved with my debugger) in
my delete function is 01/01/0001 12:00am, also known as DateTime.MinValue. My other dates appear correct.
If I remove "ReadOnly(true)" from the received at, everything works fine. Why won't "ReadOnly" allow me to have a time?
Thanks in advance,
I forgot to mention why I care. I can't submit the instance to be deleted because DateTime.MinValue is outside SQL's available datetime, so I get a SQL error. The delete also takes place in a custom delete method, but the instance.receivedAt is DateTime.MinValue
from the very beginning of the function.
Sep 08, 2010 01:17 AM|kalpatel|LINK
If you are getting proper value of receivedAt on Display, Edit and List pages, the Delete function should display it properly. There must be some issue with coding, can you please past code, which assigns instance value at beginning, and the code of your
Please make sure, you're query or stored procedure is ok, which fetches the values of instance.