How To Create A Unique Constraint On Multiple Columns

  • Thread starter Thread starter Developer Dude
  • Start date Start date
D

Developer Dude

Guest
Hello:

I am using a VB Interface With MS Acess Database. I have figured out how to create a unique constraint (to prevent

duplicate entries) on one column as follows:

Dim Unique As New UniqueConstraint(dsPSB.Tables("dtSE").Columns("SE_NAME"))
dsPSB.Tables("dtSE").Constraints.Add(Unique)

I tried to add another column to the constraint but the syntax must be incorrect.

Dim Unique As New UniqueConstraint(dsPSB.Tables("dtSE").Columns("SE_NAME"), dsPSB.Tables("dtSE").Columns("SE_CTRY"))

dsPSB.Tables("dtSE").Constraints.Add(Unique)

I would really appreciate some help.

Thanks. John.

Continue reading...
 
Back
Top