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

[B]ERROR ASP al conectar con base de datos[/B]

Estas en el tema de [B]ERROR ASP al conectar con base de datos[/B] en el foro de ASP Clásico en Foros del Web. ERROR ASP al conectar con base de datos Alguien sabe a que se puede deber este error primero creia que era porque intentaba abrir una ...
  #1 (permalink)  
Antiguo 16/07/2004, 02:38
kan
 
Fecha de Ingreso: julio-2004
Mensajes: 170
Antigüedad: 20 años, 9 meses
Puntos: 0
Pregunta [B]ERROR ASP al conectar con base de datos[/B]

ERROR ASP al conectar con base de datos Alguien sabe a que se puede deber este error primero creia que era porque intentaba abrir una conexion sin cerrar la anterior , no se si se puede abrir varias conexion y ejecutarlas una dentro de otra si se puede decidmelo ,
Ahora ya no abro una conexion dentro de otra pero me sigue dando el mismo error y eso que he cerrado y liberado la conexion anterior undefined
ADODB.Connection error '800a0bb9'
Argumentos incorrectos, fuera del intervalo permitido o en conflicto con otros.
EL CODIGO COMPLETO ES ESTE POR SI LE QUEREIS ECHAR UNA OJEADA
<% DIM DIV, I
dim sql()
dim menu
div=0
i=1
dim e
e= 1
SET con=SERVER.CREATEOBJECT("ADODB.CONNECTION")
strconn="Data Source=CASHSQL;User ID=sa;Password="
con.open strconn
SQLQUERY="SELECT count(*) as menu FROM menu WHERE ACTIVADO='S' AND COD_MENU_PADRE=0"
SET RSTABLA=con.EXECUTE(SQLQUERY)
menu=rstabla("MENu")
rstabla.close
con.close

SET con=SERVER.CREATEOBJECT("ADODB.CONNECTION")
strconn="Data Source=CASHSQL;User ID=sa;Password="
con.open strconn
SQLQUERY="SELECT top " & e & " * FROM menu WHERE ACTIVADO='S' AND COD_MENU_PADRE=0 ORDER BY ID"
SET RSTABLA=con.EXECUTE(SQLQUERY)
Select Case e
case 2
rstabla.movenext
case 3
rstabla.movenext
rstabla.movenext
case 4
rstabla.movenext
rstabla.movenext
rstabla.movenext
case 5
rstabla.movenext
rstabla.movenext
rstabla.movenext
rstabla.movenext
case 6
rstabla.movenext
rstabla.movenext
rstabla.movenext
rstabla.movenext
rstabla.movenext
End select
%>
<%'= sqlquery%>
<%
DO while e<(menu+1)%>
<td width="18%" height="38">
<div id="<%= RSTABLA("NOMBRE")%>" style="position:relative; width:184px; height:20px; z-index:2;" onmouseout="ocultar('<%= "m" & i%>')" onmouseover="mostrar('<%= "m" & i%>')">
<table width="100%" border="0" cellspacing="1" cellpadding="1" bgcolor="#E1E1E1">
<tr>
<td>
<div align="center"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a href="#"><%= RSTABLA("NOMBRE")%></a> </font></b>
<div id="<%= "m" & i%>" style="position:absolute; width:182px; height:115px; z-index:2; left: 0px; top: 20px; visibility: hidden">
<table width="100%" border="0" cellspacing="1" cellpadding="1" bgcolor="#FFFFFF">

<% rstabla.close
con.close
set rstabla=nothing
set con = nothing
%>
<%
SET con1=SERVER.CREATEOBJECT("ADODB.CONNECTION")
strconn1="Data Source=CASHSQL;User ID=sa;Password="
con1.open strconn1
sql1 ="select * from menu where activado='s' and cod_menu_padre='" & i & "'"
set rstabla1=con1.excute(sql1)%> 'AQUI ES DONDE PONE QUE ESTÁ EL ERROR
<%= sql1%>
<%
do while not rstabla1.eof %>

<tr bordercolor="#E6E6E6" >
<td bgcolor="#E1E1E1" >
<table width="100%" border="0" cellspacing="0" cellpadding="0" onMouseOver="mOvr(this,'#FFFFFF');" onMouseOut="mOut(this,'E1E1E1');" onMouseDown="mDown(this,'#FFFFFF');" onMouseUp="mUp(this,'#FFFFFF');">
<tr>
<td>
<div align="center"><font face="Verdana" size="2"><a class="mn" href="<%= rstabla1("URL") & delegaciones() %>" title="<%= rstabla1("descripcion")%>"><%=RSTABLA1("NOMBRE")%> </a></font><br>
<font face=verdana size=1 color=blue><%=RSTABLA1("traduccion")%></font></div>
</td>
</tr>
</table>
</td>
</tr>
<% rstabla1.movenext
loop %>
<

<%
rstabla1.close
con1.close
set rstabla1=nothing
set con1=nothing
i= i+1 %>
</table>
</div>

</div>
</td>
</tr>
</table>
</div>
</td>

<% e=e+1
loop %>

Última edición por kan; 16/07/2004 a las 03:00
  #2 (permalink)  
Antiguo 16/07/2004, 03:01
 
Fecha de Ingreso: julio-2004
Mensajes: 76
Antigüedad: 20 años, 10 meses
Puntos: 0
No es necesario abrir mas de una conecciòn si te conectas a la MISMA base de datos.
Usa una sola conecciòn con diferentes instrucciones SQL.
Ademàs... en que linea te da error?
__________________
Ama Martire
________________________
Hospedaje Windows & Unix Multidominio

"Si no puedes resolverlo.....evitalo"
  #3 (permalink)  
Antiguo 16/07/2004, 03:08
kan
 
Fecha de Ingreso: julio-2004
Mensajes: 170
Antigüedad: 20 años, 9 meses
Puntos: 0
YA AHORA LO ESTOY HACIENDO CON UNA SOLA CONEXION Y PASANDOLE VARIAS CONSULTAS
EL ERROR ME DA EN ESTA LINEA
sql1 ="select * from menu where activado='s' and cod_menu_padre=" & PADRE & "" EN ESTA
set rstabla=con.excute(sql1)%> AKI DA EL ERROR
VUELVO A PONER CODIGO COMPLETO HASTA LINEA DE ERROR

<% DIM DIV, I
' dim sql()
dim menu
div=0
' i=1
dim e
e= 1
SET con=SERVER.CREATEOBJECT("ADODB.CONNECTION")
strconn="Data Source=CASHSQL;User ID=sa;Password="
con.open strconn
SQLQUERY="SELECT count(*) as menu FROM menu WHERE ACTIVADO='S' AND COD_MENU_PADRE=0"
SET RSTABLA=con.EXECUTE(SQLQUERY)
menu=rstabla("MENu")
' rstabla.close
' con.close
' set rstabla=nothing
'set con = nothing

'SET con=SERVER.CREATEOBJECT("ADODB.CONNECTION")
'strconn="Data Source=CASHSQL;User ID=sa;Password="
'con.open strconn
SQLQUERY="SELECT top " & e & " * FROM menu WHERE ACTIVADO='S' AND COD_MENU_PADRE=0 ORDER BY COD_SECUENCIAL"
SET RSTABLA=con.EXECUTE(SQLQUERY)
Select Case e
case 2
rstabla.movenext
case 3
rstabla.movenext
rstabla.movenext
case 4
rstabla.movenext
rstabla.movenext
rstabla.movenext
case 5
rstabla.movenext
rstabla.movenext
rstabla.movenext
rstabla.movenext
case 6
rstabla.movenext
rstabla.movenext
rstabla.movenext
rstabla.movenext
rstabla.movenext
End select
%>
<%'= sqlquery%>
<%
DIM PADRE
PADRE= RSTABLA("COD_SECUENCIAL")
DO while e<(menu+1)%>
<td width="18%" height="38">
<div id="<%= RSTABLA("NOMBRE")%>" style="position:relative; width:184px; height:20px; z-index:2;" onmouseout="ocultar('<%= "m" & i%>')" onmouseover="mostrar('<%= "m" & i%>')">
<table width="100%" border="0" cellspacing="1" cellpadding="1" bgcolor="#E1E1E1">
<tr>
<td>
<div align="center"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><a href="#"><%= RSTABLA("NOMBRE")%></a> </font></b>
<div id="<%= "m" & i%>" style="position:absolute; width:182px; height:115px; z-index:2; left: 0px; top: 20px; visibility: hidden">
<table width="100%" border="0" cellspacing="1" cellpadding="1" bgcolor="#FFFFFF">

<% ' rstabla.close
' con.close
'set rstabla=nothing
'set con = nothing
%>
<%
'SET con1=SERVER.CREATEOBJECT("ADODB.CONNECTION")
'strconn1="Data Source=CASHSQL;User ID=sa;Password="
'con1.open strconn1
sql1 ="select * from menu where activado='s' and cod_menu_padre=" & PADRE & ""
set rstabla=con.excute(sql1)%> AKI DA EL ERROR

Última edición por kan; 16/07/2004 a las 03:23
  #4 (permalink)  
Antiguo 16/07/2004, 03:25
 
Fecha de Ingreso: julio-2004
Mensajes: 76
Antigüedad: 20 años, 10 meses
Puntos: 0
Hay un error de comillas me parece:
" & PADRE & ""
deberia ser
'" & PADRE & "'"
__________________
Ama Martire
________________________
Hospedaje Windows & Unix Multidominio

"Si no puedes resolverlo.....evitalo"
  #5 (permalink)  
Antiguo 16/07/2004, 03:39
kan
 
Fecha de Ingreso: julio-2004
Mensajes: 170
Antigüedad: 20 años, 9 meses
Puntos: 0
yA LO HE PROBADO PERO NO TIENE QUE VER CON ESO ADEMAS COD_MENU_PADRE EN NUMERICO
  #6 (permalink)  
Antiguo 16/07/2004, 04:01
 
Fecha de Ingreso: julio-2004
Mensajes: 76
Antigüedad: 20 años, 10 meses
Puntos: 0
Parece un problema de select simplemente.
No tengo la respuesta directa, pero te puedo decir loq eu harìa yo:
Verifica que valores llegan al select para saber con que valores te da error, tal vez asì logres entender que està pasando...
pon un response.write justo antes del error y mira con que valores se bloquea el select.
Luego verifica en la Base de datos PORQUE esa combinacion de variables podrìa estar causando el error.
Suerte.
__________________
Ama Martire
________________________
Hospedaje Windows & Unix Multidominio

"Si no puedes resolverlo.....evitalo"
  #7 (permalink)  
Antiguo 16/07/2004, 04:18
kan
 
Fecha de Ingreso: julio-2004
Mensajes: 170
Antigüedad: 20 años, 9 meses
Puntos: 0
gRACIAS POR TODO ES KWE TOY CIEGO NO ERA NADA DE LA SELECT ERA QUE ENVED DE PONER EXECUTE PONIA EXCUTE
JAJAJJA TENGO FALLOOS TONTOS Y HASTA KE LOS VEO... MENOS MAL KE LUEGO ME RIO
  #8 (permalink)  
Antiguo 16/07/2004, 04:22
 
Fecha de Ingreso: julio-2004
Mensajes: 76
Antigüedad: 20 años, 10 meses
Puntos: 0
yo tampoco lo vì.
__________________
Ama Martire
________________________
Hospedaje Windows & Unix Multidominio

"Si no puedes resolverlo.....evitalo"
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 11:14.