asp.net - How to Queue User Access to a Piece of Code? -


i have piece of code must prevented 2 used execute it. mean if different users press preview button queue should appear. use lock(this) in threading, work in case? need prevent users getting same id because getparticipantid() retrieves max(id) mysql table , sets id.

protected void preview_click(object sender, eventargs e)     {          try         {             collectinfo();             lock (this)             {                 database db = new database();                 id = db.getparticipantid();                 db.inserttoparticipantinfo(id, s1q1, s1q2, s1q3, s1q4, s1q5, s1q6, s1q7, s2q1, s2q2, s2q3, s2q4, s2q5, s2q6, s2q7, s2q8);                 db.inserttoparticipantcar(id, question1, question2, question3, question4, question5, question6, question7, question8, question9, question10, question11);             }         } 


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -