Hiya,
I want to update from a datatable I have,
but when I use the code below, I will get an error
Object reference not set to an instance of an object
Anyone has an idea?
This I use for loading the data
And this I use for updating it
I want to update from a datatable I have,
but when I use the code below, I will get an error
Object reference not set to an instance of an object
Anyone has an idea?
This I use for loading the data
VB.NET:
Public Sub New()
Dim i As Integer
Try
categorie = New bsCategorie
Dim cm As New OleDbCommand("SELECT * FROM tblCategorie ORDER BY Naam", cnKookboek)
da = New OleDbDataAdapter(cm)
If Not IsNothing(tblCategorie) Then
tblCategorie.Clear()
End If
tblCategorieAantal = da.Fill(tblCategorie)
Catch ex As Exception
Throw New System.Exception("dbCategorie - Sub new" & vbCrLf & ex.Message)
End Try
End Sub
And this I use for updating it
VB.NET:
Public Sub Wijzig(ByVal nCategorie As bsCategorie, ByVal pos As Integer)
Try
tblCategorie.Rows(pos).Item("Naam") = nCategorie.Naam
[b]da.Update(tblCategorie)[/b] 'The error occurs here
tblCategorie.Clear()
da.Fill(tblCategorie)
Catch ex As Exception
tblCategorie.Clear()
da.Fill(tblCategorie)
Throw New System.Exception("dbBegunstigden - Sub Wijzig" & vbCrLf & ex.Message & vbCrLf & Err.Description)
End Try
End Sub