Help with Conditional Contraints

  • Thread starter Thread starter AMDRIT
  • Start date Start date
A

AMDRIT

I have a business rule that says if a user selects the value 20 for item A
that item B must have a value of 0. I am looking for the best way to
implement this rule.



TIA

I have a sql structure like this

Main Table
(PK) MainID as int
Description as varchar(255)

Child Table
(FK) MainID as int
ChildID as int
(FK) ItemName as varchar(1)
ItemValue as int

Lookup Items Table
(PK) ItemName as varchar(1)
ItemDescription as varchar(255)

Lookup Table Item Values
(FK) ItemName as varchar(1)
(PK) ValueID as int
ItemValue as int


And data like this

Main Table
1 Something to do with EntryID 1
2 Something to do with EntryID 2

Child Table
1 1 A 20
1 2 C 999
1 3 B 0 <-- Value By Rule
2 4 A 60
2 5 B 15 <-- Any Value
2 6 C 999

Items Table
A Something to do with A
B Something to do with B
C Something to do with C

Item Values
A 1 0
A 2 20
A 3 60
A 4 120
B 5 0
B 6 15
B 7 30
C 8 999
 
Amdrit,

In my opinion is this completly dependend how you store your data.

If it is in a classic classobject than it is just the behaviour of the Set
from property a.

If it is in a datatable than you can by instance read B direct and update it
using an extra expression column.

If you want to do it using SQL, than it is in my opinion not a question for
an AdoNet newsgroup however for an SQL newsgroup.

Just my thought,

Cor
 
Back
Top