Error
Por que me da el siguiente error:
Cuando en la segunda consulta pongo menos parámetros no me da el error, sin embargo cuando completo toda la sentencia me da el error, ¿Por qué?. Gracias
. Tipo de error:
ADODB.Recordset (0x800A0BB9)
Argumentos incorrectos, fuera del intervalo permitido o en conflicto con otros.
/miWeb13/prueba.asp, line 31
<%
Option Explicit
Dim sql, rsIdentifs, username, opcion
username = Request.Cookies("username")
opcion = Request.QueryString("opcion")
%>
<%
Dim ConnectString, conn
ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("siteusers.mdb")
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ConnectString
%>
<%
Select Case opcion
'Opcion 1
Case 1
If opcion = "uno" then
sql = "SELECT 'tabla1' as Listado FROM tabla1 WHERE tabla1.username = '" & username & "' AND TABLA1.OPCION = 1 UNION SELECT 'tabla2' as Listado FROM tabla2 WHERE tabla2.username = '" & username & "' AND TABLA2.OPCION = 1 UNION SELECT 'tabla3' as Listado FROM tabla3 WHERE tabla3.username = '" & username & "' AND TABLA3.OPCION = 1 UNION SELECT 'tabla4' as Listado FROM tabla4 WHERE tabla4.username = '" & username & "' AND TABLA1.OPCION = 1 UNION SELECT 'tabla5' as Listado FROM tabla5 WHERE tabla5.username = '" & username & "' AND TABLA2.OPCION = 1"
end if
'Opcion 2
Case 2
If opcion = "dos" then
sql = "SELECT 'tabla2' as Listado FROM tabla1 WHERE tabla1.username = '" & username & "' AND TABLA1.OPCION = 2 UNION SELECT 'tabla2' as Listado FROM tabla2 WHERE tabla2.username = '" & username & "' AND TABLA2.OPCION = 2 UNION SELECT 'tabla3' as Listado FROM tabla3 WHERE tabla3.username = '" & username & "' AND TABLA3.OPCION = 2 UNION SELECT 'tabla4' as Listado FROM tabla4 WHERE tabla4.username = '" & username & "' AND TABLA1.OPCION = 2 UNION SELECT 'tabla5' as Listado FROM tabla5 WHERE tabla5.username = '" & username & "' AND TABLA2.OPCION = 2"
end if
End Select
Set rsidentifs = Server.CreateObject("ADODB.Recordset")
rsIdentifs.Open sql, conn, 3, 3
%>
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Pagina nueva 1</title>
</head>
<body>
</body>
</html>
<%
rsIdentifs.close
set rsIdentifs = nothing
conn.close
set conn = nothing
%>
Cuando en la segunda consulta pongo menos parámetros no me da el error, sin embargo cuando completo toda la sentencia me da el error, ¿Por qué?. Gracias
. Tipo de error:
ADODB.Recordset (0x800A0BB9)
Argumentos incorrectos, fuera del intervalo permitido o en conflicto con otros.
/miWeb13/prueba.asp, line 31
<%
Option Explicit
Dim sql, rsIdentifs, username, opcion
username = Request.Cookies("username")
opcion = Request.QueryString("opcion")
%>
<%
Dim ConnectString, conn
ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("siteusers.mdb")
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ConnectString
%>
<%
Select Case opcion
'Opcion 1
Case 1
If opcion = "uno" then
sql = "SELECT 'tabla1' as Listado FROM tabla1 WHERE tabla1.username = '" & username & "' AND TABLA1.OPCION = 1 UNION SELECT 'tabla2' as Listado FROM tabla2 WHERE tabla2.username = '" & username & "' AND TABLA2.OPCION = 1 UNION SELECT 'tabla3' as Listado FROM tabla3 WHERE tabla3.username = '" & username & "' AND TABLA3.OPCION = 1 UNION SELECT 'tabla4' as Listado FROM tabla4 WHERE tabla4.username = '" & username & "' AND TABLA1.OPCION = 1 UNION SELECT 'tabla5' as Listado FROM tabla5 WHERE tabla5.username = '" & username & "' AND TABLA2.OPCION = 1"
end if
'Opcion 2
Case 2
If opcion = "dos" then
sql = "SELECT 'tabla2' as Listado FROM tabla1 WHERE tabla1.username = '" & username & "' AND TABLA1.OPCION = 2 UNION SELECT 'tabla2' as Listado FROM tabla2 WHERE tabla2.username = '" & username & "' AND TABLA2.OPCION = 2 UNION SELECT 'tabla3' as Listado FROM tabla3 WHERE tabla3.username = '" & username & "' AND TABLA3.OPCION = 2 UNION SELECT 'tabla4' as Listado FROM tabla4 WHERE tabla4.username = '" & username & "' AND TABLA1.OPCION = 2 UNION SELECT 'tabla5' as Listado FROM tabla5 WHERE tabla5.username = '" & username & "' AND TABLA2.OPCION = 2"
end if
End Select
Set rsidentifs = Server.CreateObject("ADODB.Recordset")
rsIdentifs.Open sql, conn, 3, 3
%>
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Pagina nueva 1</title>
</head>
<body>
</body>
</html>
<%
rsIdentifs.close
set rsIdentifs = nothing
conn.close
set conn = nothing
%>
1 respuesta
Respuesta de shark3000
1