Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

LINQ DateTime save is not working when field need to be null

Posted on 2011-09-07
2
Medium Priority
?
264 Views
Last Modified: 2012-05-12
I am currently trying to save a record to a sql server express database.  One of the fields is a DateTime field that needs to be null upon record creation.  For some reason, even though the linq object that represents the data has a null value set for the record, I keep getting a SqlDateTime error indicating that the date enter should be between 1753 and ......., forgot the max range.  Anyway, if I am setting this field as null why is this occuring and what can I do to fix it(workarounds)?
0
Comment
Question by:rawcoder
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 23

Expert Comment

by:wdosanjos
ID: 36495552
For the field to accept null values it should be defined as DateTime? not DateTime.
0
 
LVL 4

Accepted Solution

by:
guramrit earned 2000 total points
ID: 36496819
There're two reasons for this error to occur.
1. In database, you didn't set the column with datetime datatype to Allow Null
2. In code, you'd forgot to set a value to some other column with datetime datatype.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question