By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,442 Members | 1,316 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,442 IT Pros & Developers. It's quick & easy.

adding constraint

P: 41
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
Mar 7 '08 #1
Share this Question
Share on Google+
1 Reply


deepuv04
Expert 100+
P: 227
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

Expand|Select|Wrap|Line Numbers
  1.  
  2. ALTER TABLE Table_Name
  3. ADD CONSTRAINT Column1 CHECK Column1 != Column2 )
  4.  
  5.    use try catch block before updating or inserting data into the table to catch the error
  6.  
Mar 7 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.