Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Null Dates
Message
 
À
05/08/2003 10:28:24
Mindy Shingara
Central Susquehanna Intermediate Unit
Lewisburg, Pennsylvanie, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
WebForms
Titre:
Divers
Thread ID:
00811250
Message ID:
00816898
Vues:
23
Hi Mindy,

In looking at your code, you don't seem to be initializing "dr". Change your code to the following:
Dim dtFoxProNull As DateTime = DateTime.Parse("12/10/1899")
For Each dr As DataRow In DSfatrans.Tables("fatrans").Rows
    If (DateTime.Parse(dr("tr_chkdate").ToString()) = dtFoxProNull) Then
        dr("tr_chkdate") = DBNull.Value
    End If
Next
DSfatrans.AcceptChanges()
>Hi Alan!
>Thanks for your help, but I'm still missing something. Following is my block of code exactly as in my project:
> Dim dtFoxProNull As DateTime = DateTime.Parse("12/10/1899")
> For Each tr_chkdate As DataRow In DSfatrans.Tables("fatrans").Rows
> If (DateTime.Parse(dr("tr_chkdate").ToString()) = dtFoxProNull) Then
> dr("tr_chkdate") = DBNull.Value
> End If
> Next
> DSfatrans.AcceptChanges()
>
>When I run this I get the following error: "Object reference not set to instance of an object."
>tr_chkdate is a column in my grid that will often be blank. Currently it's displaying a default date of 12/10/1899 rather than a null date.
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform