ConstraintCollection.Clear Method
.NET Framework 1.1
Clears the collection of any Constraint objects.
[Visual Basic] Public Sub Clear() [C#] public void Clear(); [C++] public: void Clear(); [JScript] public function Clear();
Remarks
The CollectionChanged event occurs if this action is successful.
Example
[Visual Basic, C#, C++] The following example clears all constraints from the ConstraintCollection.
[Visual Basic] Public Shared Sub ClearConstraints(ds As DataSet) Dim t As DataTable For Each t In ds.Tables t.Constraints.Clear() Next End Sub [C#] public static void ClearConstraints(DataSet ds) { foreach (DataTable t in ds.Tables) t.Constraints.Clear(); } [C++] public: static void ClearConstraints(DataSet* ds) { System::Collections::IEnumerator* myEnum = ds->Tables->GetEnumerator(); while (myEnum->MoveNext()) { DataTable* t = __try_cast<DataTable*>(myEnum->Current); t->Constraints->Clear(); }
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework
See Also
ConstraintCollection Class | ConstraintCollection Members | System.Data Namespace