Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Allow ONLY one booking per USER...!!!

Status
Not open for further replies.

zandyke

Programmer
Sep 11, 2006
2
MY
Hi ye'all...
i just need to know where to start or where to look how can i allow a user only three or even one booking operation and that is for a certain user im using ASP and SQL SERVER_2K5, so far all ok but a user can book all the empty slots just for fun or savataging my bookings....so im totally stuck and totally lost here, any ideas???
 
If you only want to all one booking, then you can create a primary key or unique constraint on the userid and some other unique identifing columns. If you want to allow a particular amount to be added, then you will have to do a count first (based on userid and other columns). If the user has reached the maximum you allow, you can display a message.

Jim
 
you can solve it within the database or outside.

it is possible (althgh i dont recomend it)
to use a trigger on the booking table, after insert.
you will cheack there if there are too many booking,
and if there arfe, to rase an errro, and then the insert will be cancled.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top