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.comwww.prenia.comWeblog: blogs.prenia.com/cathi