I have a C # application that is used by about a dozen employees at a time. It simply selects the top row from the SQL Server 2005 table, deletes it, and then displays the data in the form.
Once a record is selected, it must be deleted, so 2 ppl do not capture and do not work on the same record. Right straight ahead ...
I found a sentence some time ago (I can’t find the site from which I received it, sorry) to make SELECT and DELETE in the same expression and execute SqlCommand.ExecuteReader () using this “compound”:
SELECT TOP 1 * FROM Call_Table WHERE Call_Table.hold_call_till <= GetDate() ORDER BY Call_Table.attempts ASC, Call_Table.custno ASC; DELETE FROM Call_Table WHERE Call_Table.custno = (SELECT TOP 1 Call_Table.custno FROM Call_Table WHERE Call_Table.hold_call_till <= GetDate() ORDER BY Call_Table.attempts ASC, Call_Table.custno ASC);
So far it has worked very well, but I feel like I just got lucky. We are hiring about 5 new ppl and I would like to make sure that this will continue to work.
I am interested in hearing the opinions of more experienced veterinarians in this area.
Should I stick with the approach “If you haven’t broken it, don’t fix it”? Or should I activate my game and use some recordings or saved procs ??
Any suggestions will be openly accepted. If necessary, I can provide additional information about a C # table or application.
source share