Click here to Skip to main content
15,887,683 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Interview task - what can I expect? Pin
Hiren solanki3-Dec-10 2:05
Hiren solanki3-Dec-10 2:05 
GeneralRe: Interview task - what can I expect? Pin
Danpeking3-Dec-10 2:18
Danpeking3-Dec-10 2:18 
GeneralRe: Interview task - what can I expect? Pin
_AK_3-Dec-10 8:21
_AK_3-Dec-10 8:21 
AnswerRe: Interview task - what can I expect? Pin
T M Gray3-Dec-10 10:51
T M Gray3-Dec-10 10:51 
QuestionVSS with .NET Pin
padmanabhan N2-Dec-10 22:28
padmanabhan N2-Dec-10 22:28 
AnswerRe: VSS with .NET Pin
fjdiewornncalwe3-Dec-10 1:19
professionalfjdiewornncalwe3-Dec-10 1:19 
QuestionLinq-Sql DateTime? Pin
Morgs Morgan2-Dec-10 20:58
Morgs Morgan2-Dec-10 20:58 
AnswerRe: Linq-Sql DateTime? Pin
Keith Barrow2-Dec-10 22:40
professionalKeith Barrow2-Dec-10 22:40 
None of this screams LINQ-to-SQL. Your code should work is myVar.dateredeemed is of type DateTime? if not, that is the source of your problem.

This code works:

DateTime? foo;
foo = DateTime.Now;


However, you should be wary of this:

myVar.dateredeemed = DateTime.Parse("2010-12-03")


For two reasons:

  1. If the string really comes from user input, they can enter an incorrect value you need to decide whether this should be null or whether the user *must* enter a valid date. Whichever is the correct strategy, incorrect input will throw an error.
  2. Can the user enter no date, (i.e. "")? If so you code will not result in null


Finally, I'd say one more thing: If you have luxury of changing the database, avoid nulls (especially in databases) like the plague. You end up with problems similar to the one you have here, potential null reference exceptions, and they make coding SQL harder too. That's not to say don't ever use nulls, but you should think several times before using nullable columns. Personally, I'd use one of the SQL min/max dates in place of null to register "unknown", (a bit like replacing and unknown [null] string with "") but others will disagree. A null date (to represent a date not set yet) is one of the few places I think a null column might be pukka. </rant> - Sorry I didn't mean to go on like this Smile | :) .

QuestionRemoving Page's Load Event handler from my Customer Control Pin
Nadia Monalisa2-Dec-10 19:37
Nadia Monalisa2-Dec-10 19:37 
QuestionUpload file to server Pin
priyagee2-Dec-10 0:06
priyagee2-Dec-10 0:06 
AnswerRe: Upload file to server Pin
Hiren solanki2-Dec-10 0:54
Hiren solanki2-Dec-10 0:54 
GeneralRe: Upload file to server Pin
priyagee2-Dec-10 0:59
priyagee2-Dec-10 0:59 
AnswerRe: Upload file to server Pin
Hiren solanki2-Dec-10 1:05
Hiren solanki2-Dec-10 1:05 
GeneralRe: Upload file to server Pin
priyagee2-Dec-10 1:22
priyagee2-Dec-10 1:22 
GeneralRe: Upload file to server Pin
T M Gray2-Dec-10 4:20
T M Gray2-Dec-10 4:20 
GeneralRe: Upload file to server Pin
Hiren solanki2-Dec-10 20:38
Hiren solanki2-Dec-10 20:38 
GeneralRe: Upload file to server Pin
priyagee2-Dec-10 20:59
priyagee2-Dec-10 20:59 
GeneralRe: Upload file to server Pin
Morgs Morgan2-Dec-10 21:12
Morgs Morgan2-Dec-10 21:12 
GeneralRe: Upload file to server Pin
priyagee2-Dec-10 21:22
priyagee2-Dec-10 21:22 
GeneralRe: Upload file to server Pin
Morgs Morgan2-Dec-10 21:43
Morgs Morgan2-Dec-10 21:43 
GeneralRe: Upload file to server Pin
priyagee2-Dec-10 22:58
priyagee2-Dec-10 22:58 
GeneralRe: Upload file to server Pin
Morgs Morgan3-Dec-10 0:18
Morgs Morgan3-Dec-10 0:18 
AnswerRe: Upload file to server Pin
PunkIsNotDead2-Dec-10 9:46
PunkIsNotDead2-Dec-10 9:46 
Questionjavascript parsing Pin
C#Coudou1-Dec-10 21:15
C#Coudou1-Dec-10 21:15 
Answer[Cross post warning] Pin
thatraja1-Dec-10 21:27
professionalthatraja1-Dec-10 21:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.