Click here to Skip to main content
15,921,840 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi.
I have question and hope that somebody will help me to solve this problem.

for example there are textboxt , datetimepicker, datagridview and MS Access baza in my project

I have two Colums:
Column Account        Column Datetime

4                      02/02/2011                    (true)
1                      03/02/2011                    (true)
4 (adding second time) 04/05/2011 (in the same year)   i want to get error  (False)
4                      01/01/2012                (true)

And it is normal when I add "4" to database first time... I want to take "error" if i want to add "4" second time with the same year. I want one account number in one year..

Thanks in advance....
hope you will help me.
Posted
Updated 17-Mar-11 21:38pm
v2

Have a read on SQL Check Constraints! Read:
SQL CHECK Constraints[^]
SQL CHECK Constraint - 2[^]
You can have check constraints in place and go ahead smoothly.

Other way would be to handle it in UI itself.
 
Share this answer
 
Comments
Espen Harlinn 18-Mar-11 5:16am    
Reasonable reply, my 5
In MS Access, it is easy to create a validation rule. In your table go to Design View, select the column you would like to validate, and underneath in the General tab you can create a validation rule. There is a wizard which will pop up. Hope this helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900