Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Null Dates
Message
 
To
05/08/2003 10:28:24
Mindy Shingara
Central Susquehanna Intermediate Unit
Lewisburg, Pennsylvania, United States
General information
Forum:
ASP.NET
Category:
WebForms
Title:
Miscellaneous
Thread ID:
00811250
Message ID:
00816898
Views:
22
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform