G
Guest
I have a typed dataset that is display in a form with parent data in text
boxes and the child table in a componentone flexgrid. To add a row to the
child table I open a form with text boxes and then return each piece of
information to the main form. In the main for I create a new row in the
original dataset and then try to call a newly instantiated
DataAdapter.update(typeddataset.Getchanges). This does nothing and i have no
idea why. Here is code. Thanks
Private Sub Save_New_Animal(ByVal species As String, ByVal breed As
String, ByVal color As String, ByVal dateOfBirth As Date, ByVal gender As
String, ByVal comments As String, ByVal VetID As Integer)
Dim row As dsOwnersAnimals.tblAnimalRow
'row = m_OwnerDataset.tblAnimal.NewRow
row = dgAnimalInfo.DataSource
row.Fk_Owner_ID = OwnerID
row.Species = species
row.Gender = gender
row.Breed = breed
row.Color = color
row.DateOfBirth = dateOfBirth
row.Comments = comments
m_OwnerDataset.tblAnimal.AddtblAnimalRow(row)
Dim rh As New RabiesHandler
If m_OwnerDataset.HasChanges Then
rh.SaveNewAnimal(m_OwnerDataset.GetChanges)
End If
dgAnimalInfo.Refresh()
End Sub
Public Function SaveNewAnimal(ByVal ownerDataSet As dsOwnersAnimals)
Try
OwnerDataAdapter.Update(ownerDataSet)
ownerDataSet.AcceptChanges()
Catch ex As Exception
Debug.Write("Error: " + ex.Message)
End Try
End Function
boxes and the child table in a componentone flexgrid. To add a row to the
child table I open a form with text boxes and then return each piece of
information to the main form. In the main for I create a new row in the
original dataset and then try to call a newly instantiated
DataAdapter.update(typeddataset.Getchanges). This does nothing and i have no
idea why. Here is code. Thanks
Private Sub Save_New_Animal(ByVal species As String, ByVal breed As
String, ByVal color As String, ByVal dateOfBirth As Date, ByVal gender As
String, ByVal comments As String, ByVal VetID As Integer)
Dim row As dsOwnersAnimals.tblAnimalRow
'row = m_OwnerDataset.tblAnimal.NewRow
row = dgAnimalInfo.DataSource
row.Fk_Owner_ID = OwnerID
row.Species = species
row.Gender = gender
row.Breed = breed
row.Color = color
row.DateOfBirth = dateOfBirth
row.Comments = comments
m_OwnerDataset.tblAnimal.AddtblAnimalRow(row)
Dim rh As New RabiesHandler
If m_OwnerDataset.HasChanges Then
rh.SaveNewAnimal(m_OwnerDataset.GetChanges)
End If
dgAnimalInfo.Refresh()
End Sub
Public Function SaveNewAnimal(ByVal ownerDataSet As dsOwnersAnimals)
Try
OwnerDataAdapter.Update(ownerDataSet)
ownerDataSet.AcceptChanges()
Catch ex As Exception
Debug.Write("Error: " + ex.Message)
End Try
End Function