Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Say, I have a SourceList with date fields like these DateReceived, DateEntered. If these field or fields are null then in workflow updates the target list item with 1/1/1900 dates respectively.

What's the fix for this?

share|improve this question

1 Answer 1

Actually, 1/1/1900 is SQL Server's default value for datetime. For overcome this problem, you can check the value and if it is empty use SqlDateTime.Null instead of null.

if (!string.IsNullOrEmpty(dateVar))
{
   cmd.Parameters.AddWithValue("@Date", dateVar);
}
else
{
   cmd.Parameters.AddWithValue("@Date", SqlDateTime.Null);
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.