ASP/Dreamweaver Question

Soldato
Joined
8 Oct 2005
Posts
4,184
Location
Midlands, UK
Hi,

Can i do the the following in dream weaver (using server behaviors if poss)? :

I have a simple input form for say adding a new staff member to tblStaff - the form includes specifying a new staff id (which is the PK). How can restrict the input to an id that is not in tblStaff?

Thanks
 
Does StaffID need to be specified? Is there a specific business logic reason why it cannot just be an auto-incremental - this would save you the problem entirely.

If you have to do it this way, when you're inserting a new record run a query first to see if SELECT * FROM tblStaff WHERE StaffID = 'MyNewStaffID'; returns anything. If it does, stop the creation and error to the user.
 
Back
Top Bottom