nedcomp hosting homepage

Producten en Diensten
Dedicated servers
Datacenter informatie
Partners, resellers
Helpdesk informatie
Technische docs, tools
Support homepage
ASP componenten
Praktische ASP, ASP.NET
Visual route server
Whois (domein gegevens)
Software documentatie
Whitepapers
Zoeken
Nedcomp / algemeen

Zoeken
 

Copyright © Nedcomp Hosting
Telefoon nr :   +31 184 670111
Fax nummer :   +31 184 631384
E-mailadres :   info@nedcomp.nl
 

.NET Framework Class Library  

UniqueConstraint Class

Represents a restriction on a set of columns in which all values must be unique.

For a list of all members of this type, see UniqueConstraint Members.

System.Object
   System.Data.Constraint
      System.Data.UniqueConstraint

[Visual Basic]
<Serializable>
Public Class UniqueConstraint
   Inherits Constraint
[C#]
[Serializable]
public class UniqueConstraint : Constraint
[C++]
[Serializable]
public __gc class UniqueConstraint : public Constraint
[JScript]
public
   Serializable
class UniqueConstraint extends Constraint

Thread Safety

This type is safe for multithreaded read operations. You must synchronize any write operations.

Remarks

The UniqueConstraint is enforced on a single column (or columns) to ensure that a primary key value is unique.

Constraints are not enforced unless the EnforceConstraints property is set to true.

When the a DataSet is merged with a second DataSet, constraints are not enforced until all merges are completed.

Example

[Visual Basic] The following example adds a UniqueConstraint to a DataSet and sets the EnforceConstraints property to true.

[Visual Basic] 
Public Sub CreateTable()
  Dim myTable As DataTable = New DataTable
  myTable.Columns.Add("CustomerID", Type.GetType("System.String"))
  myTable.Columns.Add("CompanyName", Type.GetType("System.String"))

  Dim myUC As UniqueConstraint = New UniqueConstraint("CustConstraint", _
                                     New DataColumn() {myTable.Columns("CustomerID"), _
                                                       myTable.Columns("CompanyName")} )
  myTable.Constraints.Add(myUC)
End Sub

[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.Data

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 - Windows CE .NET

Assembly: System.Data (in System.Data.dll)

See Also

UniqueConstraint Members | System.Data Namespace | Add | Constraint | Constraints | ConstraintCollection | DataRelation | ForeignKeyConstraint