This is your SQL statement:
update Staff set Rticket='" + Session["PP"].ToString() + "' where Jobtype ='Contract'
So, it is pretty clear that it will update any record in the Staff table that has a jobtype of Contract. So, if you don't want to update all the Contract records you need to add something to your WHERE clause.
Also, some pointers:
1. You did not show all your code but you have lots of separate sql connections and sql commands. This is likely a bad way of doing things. You mention in your title about a while loop but you don't need it. It looks like you are pulling out a value, changing it and then writing back to the db. Use only a single connection for this process and a single sql command.
2. Name your controls something that makes sense. It looks like you show messages in a control named Label6. Name it lblMessages or lblError or something like that so that you don't have to switch over to your form design every time you try and figure out what that control is.