Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/02/2005, 03:55
sqa212
 
Fecha de Ingreso: mayo-2003
Mensajes: 866
Antigüedad: 22 años
Puntos: 0
Duda modificacion funcion Ugoldman

He estado viendo esta funcion que puso Ugoldman en la biblioteca:
<%
Function GetMyMaxId(table, field)
Set rsGetMyMaxId = Server.CreateObject("ADODB.Recordset")
strSQLGetMyMaxId = "SELECT MAX(" & field & ") AS myMax FROM " & table
rsGetMyMaxId.Open strSQLGetMyMaxId, ObjConn, 3, 3
fnctMyMaxId = rsGetMyMaxId("myMax")
If IsNull(fnctMyMaxId) Then
fnctMyMaxId = 0
End If
rsGetMyMaxId.Close
Set rsGetMyMaxId = Nothing
GetMyMaxId = fnctMyMaxId
End Function
%>

Llamada a la función

Cita:
MaxID = GetMyMaxId("tabla", "campo")


¿Como podria modificar la funcion para que me proporcionase en lugar del valormaximo que toma el campo, el autonumerico(clave principal) de la tabla?


GetMyMaxId("autonumerico" ,"tabla", "campo")