vbGISguy
Sep 29th, 2000, 01:11 PM
With a SQL statement, we are getting the next most important ticket out of the database and marking it with the UserId of the person who hit "Get Next Ticket" button. The SQL string that does this is Connection.Executed. The result should be that users *cannot* grab a ticket that they did not mark so that we don't have people working on the same tickets. Once the user is done with the ticket, and the "Update" button is pressed, changes/updates are made to the ticket and his/her UserId is removed from the ticket.
The definition of the executed SQL string variable fwithin VB follows:
/*SNIP
strReserveNextTicket = "UPDATE T_TICKET" & _
" SET researcher = '" & strUserID & "'" & _
" FROM" & _
" (SELECT TOP 1 T_TICKET.ticket_number, T_TICKET.sequence_number, T_TICKET.transmit_dt" & _
" FROM T_TICKET INNER JOIN" & _
" T_WORKFLOW_STATUS ON" & _
" T_TICKET.workflow_status_id = T_WORKFLOW_STATUS.workflow_status_id" & _
" Inner Join" & _
" T_USER_WKFLW ON" & _
" T_WORKFLOW_STATUS.workflow_status_id = T_USER_WKFLW.workflow_status_id" & _
" WHERE (recipient_type_cd = '" & strUserType & "' OR" & _
" recipient_type_cd = 'RES') AND (researcher is null)" & _
" ORDER BY type, transmit_dt) as TOPTICKET" & _
" WHERE T_TICKET.ticket_number = TOPTICKET.ticket_number AND" & _
" T_TICKET.sequence_number = TOPTICKET.sequence_number AND" & _
" T_TICKET.transmit_dt = TOPTICKET.transmit_dt"
/*SNIP
cursorlocation = adUseClient (should this be server side?)
cnULTRATixNum.Execute strReserveNextTicket
PROBLEM:
Users are somehow still getting the same ticket.
Is there a problem in the logic there? Should this logic (assuming it is not flawed) be rewritten into a stored procedure? How does SQL Server 7.0 process this statement...does it break it down into pieces as opposed to a single executed action so that this problem of 2 people getting the same ticket can occur?
We are trying to essentially mark the ticket a user gets from the database so that no one else will access it. Because of the nature of the work being done, it is possible for a user to download the latest greatest ticket and not perform edits on it for several minutes.
Any suggestions about our current logic or a different approach are appreciated.
Thanks,
Jason
The definition of the executed SQL string variable fwithin VB follows:
/*SNIP
strReserveNextTicket = "UPDATE T_TICKET" & _
" SET researcher = '" & strUserID & "'" & _
" FROM" & _
" (SELECT TOP 1 T_TICKET.ticket_number, T_TICKET.sequence_number, T_TICKET.transmit_dt" & _
" FROM T_TICKET INNER JOIN" & _
" T_WORKFLOW_STATUS ON" & _
" T_TICKET.workflow_status_id = T_WORKFLOW_STATUS.workflow_status_id" & _
" Inner Join" & _
" T_USER_WKFLW ON" & _
" T_WORKFLOW_STATUS.workflow_status_id = T_USER_WKFLW.workflow_status_id" & _
" WHERE (recipient_type_cd = '" & strUserType & "' OR" & _
" recipient_type_cd = 'RES') AND (researcher is null)" & _
" ORDER BY type, transmit_dt) as TOPTICKET" & _
" WHERE T_TICKET.ticket_number = TOPTICKET.ticket_number AND" & _
" T_TICKET.sequence_number = TOPTICKET.sequence_number AND" & _
" T_TICKET.transmit_dt = TOPTICKET.transmit_dt"
/*SNIP
cursorlocation = adUseClient (should this be server side?)
cnULTRATixNum.Execute strReserveNextTicket
PROBLEM:
Users are somehow still getting the same ticket.
Is there a problem in the logic there? Should this logic (assuming it is not flawed) be rewritten into a stored procedure? How does SQL Server 7.0 process this statement...does it break it down into pieces as opposed to a single executed action so that this problem of 2 people getting the same ticket can occur?
We are trying to essentially mark the ticket a user gets from the database so that no one else will access it. Because of the nature of the work being done, it is possible for a user to download the latest greatest ticket and not perform edits on it for several minutes.
Any suggestions about our current logic or a different approach are appreciated.
Thanks,
Jason