I'm working with an Access Database, and the below code keeps giving me the error that it can not set the field EersteVerschijning (even when I do fill in a date). This is a Nullable(Of DateTime) field, to read the fields from the database I checked for IsDBNull and set them to Nothing if that was the case, so I've tried writing Nothing to the database and DBNull.value but no luck so far? any ideas anyone? feel free to ask for more explanation too
Public Sub VoegToe(ByVal nKrant As bsKrant)
Dim pos As Integer
Try
Dim drv As DataRowView = dv.AddNew
With nKrant
drv("Titel") = .Titel
drv("EersteVerschijning") = .EersteVerschijning
drv("Frequentie") = .Frequentie
End With
drv.EndEdit()
AddHandler da.RowUpdated, AddressOf OnRowUpdated
da.Update(dsProject, "kranten")
pos = Zoek(drv("Krantnr").ToString, "Krantnr")
GaNaar(pos)
Catch ex As Exception
dsProject.Tables("kranten").Clear()
da.Fill(dsProject, "kranten")
Throw New System.Exception("dbKranten - Sub VoegToe" & vbCrLf & ex.Message)
End Try
End Sub
Public Sub VoegToe(ByVal nKrant As bsKrant)
Dim pos As Integer
Try
Dim drv As DataRowView = dv.AddNew
With nKrant
drv("Titel") = .Titel
drv("EersteVerschijning") = .EersteVerschijning
drv("Frequentie") = .Frequentie
End With
drv.EndEdit()
AddHandler da.RowUpdated, AddressOf OnRowUpdated
da.Update(dsProject, "kranten")
pos = Zoek(drv("Krantnr").ToString, "Krantnr")
GaNaar(pos)
Catch ex As Exception
dsProject.Tables("kranten").Clear()
da.Fill(dsProject, "kranten")
Throw New System.Exception("dbKranten - Sub VoegToe" & vbCrLf & ex.Message)
End Try
End Sub