removing table from dataset
Hi i am working in asp.net
in my dataset i am using Parent,ChildTables.Like below i am maintaing the relation between 2 tables.
OleDbDataAdapter2.Fill(Dataset21, ChildTable)
OleDbDataAdapter1.Fill(Dataset21, ParentTable)
If (Dataset21.Relations.Count < 1) Then
relApserverIntalledApp = New DataRelation("Relat1", Dataset21.Tables(ParentTable).Columns("id"), Dataset21.Tables(ChildTable).Columns("Serverid"))
Dataset21.Relations.Add(relApserverIntalledApp)
End If
In one case i want to delete the parenttable from my dataset and want to add it again.
i am doing like below
sbSQl.Append(" select * from Parenttable wehere ....")
Me.OleDbSelectCommand1.CommandText = sbSQl.ToString
Me.OleDbDataAdapter1.Fill(Dataset21.Tables(ParentT able)))
Session.Add("TempTable", Dataset21.Tables(ParentTable)))
then here i am adding the session temptable to dataset21 and want to delete the parent table from dataset
when i try to delete the table from data set like below
Dataset21.Tables.Remove(ParentTable)(here i tried first remove from childtable then parent still same below error)
But it saying
Cannot remove table parenttable, because it referenced in ForeignKeyConstraint xxx. Remove the constraint first.
when i try to remove the constraint its giving can't remove Constraint because its primay key ...
so how to delete the table from my dataset21??
|