Foros del Web » Programando para Internet » ASP Clásico »

No me funciona una funcion de la Biblioteca

Estas en el tema de No me funciona una funcion de la Biblioteca en el foro de ASP Clásico en Foros del Web. Esta pregunta hace referencia a una funcion aportada por U goldman en un mensaje con el titulo Biblioteca de Clases,Funciones y Sub-rutinas. http://www.forosdelweb.com/showthread.php?t=238829 Este es ...
  #1 (permalink)  
Antiguo 15/10/2004, 10:35
 
Fecha de Ingreso: mayo-2003
Mensajes: 866
Antigüedad: 22 años
Puntos: 0
No me funciona una funcion de la Biblioteca

Esta pregunta hace referencia a una funcion aportada por U goldman en un mensaje con el titulo Biblioteca de Clases,Funciones y Sub-rutinas.

http://www.forosdelweb.com/f15/biblioteca-clases-funciones-sub-rutinas-238829/

Este es el error que obtengo:
Tipo de error:
ADODB.Recordset (0x800A0BB9)
Argumentos incorrectos, fuera del intervalo permitido o en conflicto con otros.
/webgs/valormaximo.asp, línea 20

Esta es la linea 20

rsGetMyMaxId.Open strSQLGetMyLastId, OConn, 3, 3

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!-- #INCLUDE File="adovbs.inc" -->
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

<%
Dim oConn
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open ("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("basedatos.mdb"))
%>
<%
Function GetMyMaxId(table, field)
Set rsGetMyMaxId = Server.CreateObject("ADODB.Recordset")
strSQLGetMyMaxId = "SELECT MAX(" & field & ") AS myMax FROM " & table
rsGetMyMaxId.Open strSQLGetMyLastId, OConn, 3, 3
fnctMyMaxId = rsGetMyLastId("myMax")
If IsNull(fnctMyMaxId) Then
fnctMyMaxId = 0
End If
rsGetMyMaxId.Close
Set rsGetMyMaxId = Nothing
GetMyMaxId = fnctMyMaxId
End Function
%>

<%MaxID = GetMyMaxId("productos", "lecturas") %>
<%=MaxID %>
<%oConn.Close
%>
</body>
</html>
  #2 (permalink)  
Antiguo 15/10/2004, 10:42
Avatar de u_goldman
Moderador
 
Fecha de Ingreso: enero-2002
Mensajes: 8.031
Antigüedad: 23 años, 4 meses
Puntos: 98
Perdon, el problema está en esta línea:

rsGetMyMaxId.Open strSQLGetMyLastId, OConn, 3, 3

Debería ser así

rsGetMyMaxId.Open strSQLGetMyMaxId, OConn, 3, 3

La corregiré también en el post


Salu2,
__________________
"El hombre que ha empezado a vivir seriamente por dentro, empieza a vivir más sencillamente por fuera."
-- Ernest Hemingway
  #3 (permalink)  
Antiguo 15/10/2004, 10:44
 
Fecha de Ingreso: mayo-2003
Mensajes: 866
Antigüedad: 22 años
Puntos: 0
Muchas gracias
Tienes que cambiar tambien la siguiente linea:

Tu tienes esto:
fnctMyMaxId = rsGetMyLastId("myMax")

DEbes poner:

fnctMyMaxId = rsGetMyMaxId("myMax")

Última edición por sqa212; 15/10/2004 a las 10:46
  #4 (permalink)  
Antiguo 15/10/2004, 10:45
Avatar de u_goldman
Moderador
 
Fecha de Ingreso: enero-2002
Mensajes: 8.031
Antigüedad: 23 años, 4 meses
Puntos: 98
La dejo corregida, ya está corregida también 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
%>
__________________
"El hombre que ha empezado a vivir seriamente por dentro, empieza a vivir más sencillamente por fuera."
-- Ernest Hemingway
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 19:07.