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:
00708025
Vues:
13
>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 had the crashing problem when testing for DBNull as well.
The only way I found to do it was like this:
dr ["dExpires"].GetType().ToString() != "System.DBNull"

I know it seems somewhat backA$$ed but without converting to a string it was crashing.
Chris
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform