I have a small label printing software that print sequential numbers. It selects the last
serialnumber on sql db's and add one.
The problem I have is that I need now two users to print sequential serial numbers.
SQL Select statement:
sql_query.CommandText = "SELECT TOP 1 cast (serialnumber as nvarchar) as serialnumber, indexnumber, versao FROM etiquetas where partnumber Like '" & partnumber & "' ORDER BY serialnumber DESC"
Sql Insert Statement:
"if not exists (select serialnumber from etiquetasklc.dbo.etiquetas where partnumber like '" & partnumber & "' and serialnumber like '" & serialnumber & "') begin INSERT INTO etiquetasklc.dbo.etiquetas(Nome_Posto, data, Lote, serialnumber, partnumber, Versao, indexnumber, Semana, QRGerado, operador) VALUES( '" & posto & "','" & data & "','" & ordemfabrico & "','" & serialnumber & "','" & partnumber & "', '" & partnumber2 & "','" & indexnumber & "','" & weekyear & "','" & codigo & "','" & operador & "') end "
The problem occurs when they hit the print button simultaneous.
Can anyone help me
I'm no coder and the SQL is wrote based on my limited skills