adding constraint

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dipalichavan82
    New Member
    • Feb 2008
    • 41

    adding constraint

    mine is windows applicatn,i have 2 textbox on form, i want both values should not be equal. i dont want to use errorprovider control in .net. i want to add constraint on table so dat my condition will b checked
    plz help
  • deepuv04
    Recognized Expert New Member
    • Nov 2007
    • 227

    #2
    Originally posted by dipalichavan82
    mine is windows applicatn,i have 2 textbox on form, i want both values should not be equal. i dont want to use errorprovider control in .net. i want to add constraint on table so dat my condition will b checked
    plz help
    if you want to use constraints at database level use check constraint like

    [code=sql]

    ALTER TABLE Table_Name
    ADD CONSTRAINT Column1 CHECK Column1 != Column2 )

    use try catch block before updating or inserting data into the table to catch the error
    [/code]

    Comment

    Working...