Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Transação x RLOCK()
Message
 
To
29/01/2002 22:20:35
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00612586
Message ID:
00612704
Views:
26
Carlos,

Eu uso a primeira opção, e tive problemas em situações isoladas, quando ocorre queda de energia e/ou travamento das maquinas.
Para garantir um código único, eu passei a fazer o seguinte:
Begin Transaction
   Do While .T.
      m.Codigo = GerarCodigo("clientes")
      Select Codigo From Clientes Where Codigo = m.Codigo Into Array Repetido
      If _Tally=0
         Exit
      EndIf
   EndDo
   m.Nome = ThisForm.Nome.Value
   Insert Into Clientes (Codigo, Nome) Values (m.Codigo, m.NOme)
End Transaction
A idéia é mais ou menos essa aí... Sempre teste antes de gravar e se estiver repetido, chame novamente a rotina para gerar o código.

[]s
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Rodolfo Duarte
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform