I have code to generate transaction number.
hire my code :
VB Code:
  1. Function TransNumber() As String
  2.         Dim oCmd As New OleDb.OleDbCommand
  3.         Dim sNo As String = "P"
  4.  
  5.         Try
  6.             oCmd.CommandText = "select top 1 pono from PURCHASE where order by pono  desc"
  7.             Dim dr As OleDb.OleDbDataReader
  8.             dr = oCmd.ExecuteReader
  9.             If dr.Read Then
  10.                 sNo = dr.Item("pono") + 1
  11.             Else
  12.                 sNo += "001"
  13.             End If
  14.             dr.Close()
  15.         Catch ex As Exception
  16.  
  17.         End Try
  18.     End Function

I had a problem when there are multiple users using the transaction or the serial number is, because the data overwrite each other.

how to make the correct serial number?