TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
dc
NA
663
0
C# default datetime
Oct 14 2012 4:42 PM
In a C# 2010 application, I am using a linq to sql statement to obtain a start datetime. If nothing is returned from the linq statement, I want to set a default date and time. However whenever I set the date to in the statement, the date ends up being 01/01/0001.
DateTime StartDateTime = rta.eransaction.Where(c => c.ResDate != null ).Select(c => c.ResDate).Max().GetValueOrDefault();
if (StartDateTime == null)
{
StartDateTime = Convert.ToDateTime("2010-08-14 12:33:36.590");
}
There will be times when I expect the ResDate from the query to be empty.
Thus can you tell me what I can do to the code above so that the startdatetime acutally gets the value I get to it in the code?
Reply
Answers (
1
)
How to upload any file using C# desktop application?
autosuggestion in textbox from sqlserver 2005