Hello,
I have an invoice file with a field InvoiceNumber, when the user add a record, the invoice number must be the last one + 1
In a SQL network environment, how can i be shure that dont have 2 times the same number .
With DBF, when i want to do the same, i open an other file (LOCK.DBF) in EXCLUSIVE MODE and. if neterr() return .T. ,
i select the INVOICE file, go bottom , place last invoicenumber in memory, i add a new record in INVOICE file , replace InvoiceNumber with last one+1 and than i close the LOCK file .
If an other user try to add a record at same time, the EXCLUSIVE MODE (LOCK.DBF) return FALSE and the user is invited to try again .
How to do this with SQL code ?
Thanks
I