Question DataTable Column of Type DateTime

DennisH

Member
Joined
Jun 22, 2012
Messages
6
Programming Experience
3-5
I have created a DataTable "dTable" and am trying to add a column of type DataTime then add a row with the DateTime column set to Jan 1, 2012. I have added several other columns of various types then added a row with the columns filled in. However, whenever I try to add a row with the DateTime set to anything else but null, I get the error below.
dTable.Columns.Add("Birthday", System.Type.GetType("System.DateTime"))
Dim r As DataRow = dTable.NewRow
r("Birthday") = New DateTime(2012,1,1)
dTable. Rows.Add(r)

'Here I get the following error: "A first chance exception of type 'System.Data.EvaluateException' occurred in System.Data.dll"

 
Thanks to all who viewed the Question on DataTable and DateTime type. I found the error as it was in the next column type which was set up to automatically fill with a difference in dates. It was set up wrong and when I tried to set the Date Column, it caused an error when trying to set the next column date difference.
 
Back
Top