Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning a null date value
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00707962
Message ID:
00708480
Vues:
8
>Hi All,
>
>I am trying to get date values from my SQL Server 2000 database. One of the values may be null, this is valid because until a transaction gets processed this value is null. I am using a strongly typed dataset, and it won't return anything because the ctype function fails. I am even trying to test for dbnull in the strongly typed dataset class and return January 1, 0001 if the value is dbnull. However, I keep getting an exception thrown when attempting to test for DBNull. Should I be setting the date value to January 1, 0001 when I add the record to avoid null values?
>
>If anyone has some insight on this problem, I would greatly appreciate any suggestions.
>
>Thanks in advance,
>
>Rodney Hall

I have used the try/catch block to intercept the error that is thrown when you test for a null date. In the catch block, I set the value to DateTime.Minimum and pass that as the return value from my function.

Dick Harrold
=========================================
Dick Harrold [DickHarrold@Yahoo.com]
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform