E
Earl
I'm using a Public dataset in the module for all data throughout the
project. For most forms, this is great, no need to instantiate a new object,
just clear the datatables and reload as needed.
However, an issue arises where I have data relations in a form. Reloading
the data on those forms requires clearing the relation and the datatables.
What I've done in the past is reset the dataset and clear the relations.
This also works fine -- except for the obvious, that being that it kills off
any data in the dataset.
So, I've tried to just clear the tables and then clear the dataset
relations. This causes an exception on the 2nd load of data ("The row
doesn't belong to the same DataSet as this relation.").
How do I resolve this -- without creating a new dataset for each form where
I have a data relation?
*********************************************************
TECHNIQUE A (this works well, except clears the dataset entirely)
ds.Reset()
ds.Relations.Clear()
TECHNIQUE B (this causes an exception on 2nd load of employee data)
If ds.Tables.Contains("dtEmployees") Then
ds.Tables("dtEmployees").Clear()
End If
If ds.Tables.Contains("dtEmpCategoryMatches") Then
ds.Tables("dtEmpCategoryMatches").Clear()
End If
ds.Relations.Clear()
project. For most forms, this is great, no need to instantiate a new object,
just clear the datatables and reload as needed.
However, an issue arises where I have data relations in a form. Reloading
the data on those forms requires clearing the relation and the datatables.
What I've done in the past is reset the dataset and clear the relations.
This also works fine -- except for the obvious, that being that it kills off
any data in the dataset.
So, I've tried to just clear the tables and then clear the dataset
relations. This causes an exception on the 2nd load of data ("The row
doesn't belong to the same DataSet as this relation.").
How do I resolve this -- without creating a new dataset for each form where
I have a data relation?
*********************************************************
TECHNIQUE A (this works well, except clears the dataset entirely)
ds.Reset()
ds.Relations.Clear()
TECHNIQUE B (this causes an exception on 2nd load of employee data)
If ds.Tables.Contains("dtEmployees") Then
ds.Tables("dtEmployees").Clear()
End If
If ds.Tables.Contains("dtEmpCategoryMatches") Then
ds.Tables("dtEmpCategoryMatches").Clear()
End If
ds.Relations.Clear()