D
Developer Dude
Guest
Hi:
I am still working on my simple data app. I have a parent table (dtSE) and a Child table (dtAM). I have a datarelation
established.
Dim data_relation As New _
DataRelation("SE_AM", dsPSB.Tables("dtSE").Columns("SE_KEY"), dsPSB.Tables("dtAM").Columns("AM_SE_KEY"))
dsPSB.Relations.Add(data_relation)
When I close the app, I use the following code to remove the datarelation.
'Remove The SE-AM DataRelation From The DataSet.
If dsPSB.Relations.Contains("SE_AM") Then
dsPSB.Relations.Remove("SE_AM")
End If
'Remove The Assignment DataTable From The DataSet.
dsPSB.Tables("dtAM").Clear()
dsPSB.Tables("dtAM").Dispose()
This works fine. However, now I want to use a constraint to prevent duplicate rows in "dtAM" using
'Create A Unique Constraint To Prevent Duplicate Entries.
Dim Unique As New UniqueConstraint({dsPSB.Tables("dtAM").Columns("AM_SE_KEY"),
dsPSB.Tables("dtAM").Columns("AM_ASSIGNMENT")})
dsPSB.Tables("dtAM").Constraints.Add(Unique)
I need to know how to remove this constraint as well. I would appreciate some help. Thanks.
Continue reading...
I am still working on my simple data app. I have a parent table (dtSE) and a Child table (dtAM). I have a datarelation
established.
Dim data_relation As New _
DataRelation("SE_AM", dsPSB.Tables("dtSE").Columns("SE_KEY"), dsPSB.Tables("dtAM").Columns("AM_SE_KEY"))
dsPSB.Relations.Add(data_relation)
When I close the app, I use the following code to remove the datarelation.
'Remove The SE-AM DataRelation From The DataSet.
If dsPSB.Relations.Contains("SE_AM") Then
dsPSB.Relations.Remove("SE_AM")
End If
'Remove The Assignment DataTable From The DataSet.
dsPSB.Tables("dtAM").Clear()
dsPSB.Tables("dtAM").Dispose()
This works fine. However, now I want to use a constraint to prevent duplicate rows in "dtAM" using
'Create A Unique Constraint To Prevent Duplicate Entries.
Dim Unique As New UniqueConstraint({dsPSB.Tables("dtAM").Columns("AM_SE_KEY"),
dsPSB.Tables("dtAM").Columns("AM_ASSIGNMENT")})
dsPSB.Tables("dtAM").Constraints.Add(Unique)
I need to know how to remove this constraint as well. I would appreciate some help. Thanks.
Continue reading...