Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/04/2006, 02:45
desbarrao
 
Fecha de Ingreso: mayo-2005
Mensajes: 36
Antigüedad: 20 años
Puntos: 0
Concurrencia al crear una Id

He visto en el apartado de "Biblioteca de Clases,Funciones y Sub-rutinas." la siguiente codigo

Código:
Function GetMyMaxId(table, field)
	Set rsGetMyMaxId = Server.CreateObject("ADODB.Recordset")
	strSQLGetMyMaxId = "SELECT MAX(" & field & ") AS myMax FROM " & table
	rsGetMyMaxId.Open strSQLGetMyMaxId, <B>ObjConn</B>, 3, 3
	fnctMyMaxId = rsGetMyMaxId("myMax")
	If IsNull(fnctMyMaxId) Then
		fnctMyMaxId = 0
	End If
	rsGetMyMaxId.Close
	Set rsGetMyMaxId = Nothing
	GetMyMaxId = fnctMyMaxId
End Function
Esta muy bien para obtener, por ejemplo, la id de una tabla. Pero que pasaria si dos usuarios entrasen a la vez y obtendrian el mismo Id. Tengo entendido que en .NET hay alguna manera de controlar esto pero en ASP 3.0 no lo se. ¿Sabeis de alguna forma de controlarlo?