Click here to Skip to main content
14,872,699 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Order Date CourseName

2/25/2013 GMDSS
2/26/2013 ASM

Design as follows

Order Date textbox1 (calendar)
CourseName textbox2

When i select the date in the calendar that date is display in the textbox1.
in courseName enters the course and save in the database.



i want to validate, if the user select the same date and save in the database
that time shows the message selected date is already exists.


how to validate the selected date is exists in the database.

for that before saving in the database shows the popup message the selected date is already exist.

Note it is windows application.

How can i do?

Please help me.
Posted
Comments
[no name] 27-Feb-13 9:19am
   
I usually find that if I try and SELECT something in a database and get a result back, I can pretty much say that what I SELECTed exists in the database.... So, what is it that you have tried for yourself that is not working?

1 solution

Hello friend,

you can go with this way...

before saving record to your database, you need to fire select query to you database with having where condition and pass selected data as where condition parameter, if any record is selected it means there is also a record having same date in your database, so then you can popup a message that date is already exist in database and skip process of inserting data.


Or this way....


You can specify unique constrain on your date column, so every time while you are going to insert data and if already same data is exists then it will throw unique constraint violated error, that means you need to show your message that selected date is already exist in database.
   

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