Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

claytonprog

Simulado On-Line

Recommended Posts

Pessoal estou tentando montar simulado on-line com um código que peguei na net. Está quanse pronto, porém está dando um erro.

 

vejam o código abaixo:

 

seleciona_disciplina.asp<% @LANGUAGE=VBSCRIPT %><!--#include file="config.inc" --><%Response.AddHeader "pragma","no-cache"Response.AddHeader "cache-control","private"Response.CacheControl = "no-cache"Response.CacheControl = "no-cache"if Session("brquiz") <> "logado" thenResponse.Redirect("login.asp")sql3 = "SELECT * FROM usuarios WHERE login = '" & Session("username") & "'"Set rs3 = Server.CreateObject("ADODB.Recordset")rs3.CursorType = 3rs3.CursorLocation = 3rs3.LockType = 3rs3.Open sql3, connelse%><%'Seta as conecao Set conn = Server.CreateObject("ADODB.Connection")'Seta os registrosset rs = server.createobject("adodb.RecordSet")'Seta caminho para abrir bancoconn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("bd/simulado.mdb")'ConsultaSQL = "SELECT * FROM disciplinas Order By descricao Desc"'Abre conexaors.open sql, conn, 3, 3'Acerta a posição do cursor'rs.CursorLocation = adUseClient'Define o tamanho do Cache = para o número de páginasrs.CacheSize = 30'Move o cursor para a primeira linha rs.MoveFirst%><html><head><meta http-equiv="Content-Language" content="pt-br"><META http-equiv=Content-Type content="text/html; charset=windows-1252"><LINK HREF="style1.css" TYPE="text/css" REL="stylesheet"><LINK href="default.css" type=text/css rel=stylesheet><script src="codigos.js" type=text/javascript></SCRIPT><style type="text/css">		<!--			a:active{				text-decoration: none;				color: #333333;			}			a:hover{				text-decoration: none;				color: #000000;			}			a:link{				text-decoration: none;				color: #333333;			}			a:visited{				text-decoration: none;				color: #333333;			}			.Texto1{				font-family: Verdana;				font-size: 10px;				font-weight: none;				color: #000000;				text-decoration: none;			}			.Texto2{				font-family: Verdana;				font-size: 10px;				font-weight: bold;				color: #000000;				text-decoration: none;			}			.Borda1{				border: 1px solid #999999;			}			.Form1{				border: 1px solid #999999;				font-family: Verdana;				font-size: 12px;				color: #000000;				text-decoration: none;				background-color: #F4F4F4;			}		-->		</style><title>Simulado On-Line</title></head><center><body style="background-color: #C0C0C0" link="#000000" alink="#800000" vlink="#7D7D7D"><table width="42%" border="0" cellpadding="0" cellspacing="0" >  <tr>   	<td width="422" align="left" valign="top">	<div align="center">	<table width="422"  border="0" cellspacing="0" cellpadding="0">	  <tr align="left" valign="top">		<td width="422" height="100%">		<div align="center">		<table width="356"  border="0" cellspacing="0" cellpadding="0" height="237">		  <tr>			<td align="center" valign="top" style="border-top:5px solid #EBEBEB" height="237" width="356">			<table width="50%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#EBEBEB" height="1">			  <tr align="left" valign="top">				<td width="359" height="1" bgcolor="#FFFFFF">				<div align="center">				<table width="421"  border="1" cellspacing="0" cellpadding="0" style="height:232px " bordercolor="#C0C0C0">					<TR> 	<TD HEIGHT="230" style="border-left-style:solid; border-left-width:1; border-right-style:solid; border-right-width:1; border-top-style:none; border-top-width:medium; border-bottom-style:solid; border-bottom-width:1" width="417" bgcolor="#FFFFFF"> 	  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-left-width:0; border-right-width:0; border-bottom-width:0" bordercolor="#C0C0C0" width="98%" id="AutoNumber18" height="226">		<tr>				<td width="98%" style="border-style: none; border-width: medium" height="225" bordercolor="#C0C0C0" bgcolor="#FFFFFF">								  <p align="center"><font face="Verdana"><font size="2">								  <b>								  <font color="#D2691E"><br> </font> 								  <font color="#800000">Seja   bem vindo ao</font><font color="#D2691E"> </font> 								  </b> </b> <strong>Simulado On-line</em></strong></font><b><font size="2" color="#D2691E"><em><br> </font></b></font><p align="center"><img src="img/Simulado.png" width="166" height="100" border="0"><p align="center">									<b>									<font size="3" face="Verdana" color="#800000">									Selecione a Disciplina</font><font size="2" face="Verdana" color="#800000"></font></b><table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" bordercolor="#111111" width="419" id="AutoNumber3" height="91">						<tr>						  <td width="419" style="border-style: none; border-width: medium" height="1">						  <tr> 		  <td height="90" valign="top" align="center" style="border-style:none; border-width:medium; " width="419">			  			  			  				<table border="1" cellspacing="1" style="border-collapse: collapse; border-right-width:0px" width="99%">					<tr>										 <% Do while not rs.eof %> <tr><td align="left" valign="top" style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium"><p align="center"></a></b><br></b><br><font face="Verdana" size="2" color="#00080"><%=rs("descricao")%><br><a href="simulado.asp?id2=<%=rs("descricao")%>"><font face="Verdana" size="2" color="#00000">[ Acessar Simulado ] <br></tr><%rs.movenextloop%> 						</td>					</tr>				</table>			 			</td>		</tr></td>						</tr>					  </table>								  <p style="text-align: center"><b>								  <font size="2" face="Verdana">								  <a href="../index.asp">Voltar</a></font></b></td>			  </tr></td>		</tr>	  </table>	  		  	  	  		  	  <TABLE WIDTH="50%" BORDER="0" ALIGN="CENTER" CELLPADDING="0">			  </TABLE>	  </TD>  </TR></td>				  </tr>				  </table>				</div>				</td>			  </tr>			</table></td>		  </tr>		  </table>		  </div>	  </tr>	</table>		  </div>	</center>  </table></body><%end if %></html>

página que está dando o errosimulado.asp<% @LANGUAGE=VBSCRIPT %><!--#include file="config.inc" --><%Response.Expires = 60Response.Expiresabsolute = Now() - 1Response.AddHeader "pragma","no-cache"Response.AddHeader "cache-control","private"Response.CacheControl = "no-cache"if Session("brquiz") <> "logado" thenResponse.Redirect("login.asp")elseid2 = Request.querystring("id2")Session.TimeOut = "1"strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath(bdados)Set conn = Server.CreateObject("ADODB.Connection")conn.open strConSQL = "SELECT * FROM perguntas where disciplinas = "&id2Set rs = Server.CreateObject("ADODB.Recordset")rs.CursorType = 3rs.CursorLocation = 3rs.LockType = 3[color="#8B0000"]rs.Open sql, conn[/color] erro nesta linhaDim Arr()Dim i, RowCountRowCount = RS.RecordCountRedim Arr(RowCount - 1)For i = 0 To RowCount - 1Arr(i) = RS("id")rs.movenextNextRandomize'perg_id = Arr(Int((Ubound(arr) + 1) * rnd))rs.closesql2 = "SELECT * FROM perguntas WHERE id = "& perg_id & ""Set rs2 = Server.CreateObject("ADODB.Recordset")rs2.Open sql2, conn' Verifica se o existe a pergunta selecionada aleatoreamente, não houver a página será recarregada...' Então evite deletar perguntas do banco de dados do quiz!if rs2.eof thenresponse.redirect("simulado.asp")end if%><html><head><meta http-equiv="Content-Language" content="pt-br"><META http-equiv=Content-Type content="text/html; charset=windows-1252"><LINK HREF="style1.css" TYPE="text/css" REL="stylesheet"><LINK href="default.css" type=text/css rel=stylesheet><script src="codigos.js" type=text/javascript></SCRIPT><style type="text/css">		<!--			a:active{				text-decoration: none;				color: #333333;			}			a:hover{				text-decoration: none;				color: #000000;			}			a:link{				text-decoration: none;				color: #333333;			}			a:visited{				text-decoration: none;				color: #333333;			}			.Texto1{				font-family: Verdana;				font-size: 10px;				font-weight: none;				color: #000000;				text-decoration: none;			}			.Texto2{				font-family: Verdana;				font-size: 10px;				font-weight: bold;				color: #000000;				text-decoration: none;			}			.Borda1{				border: 1px solid #999999;			}			.Form1{				border: 1px solid #999999;				font-family: Verdana;				font-size: 12px;				color: #000000;				text-decoration: none;				background-color: #F4F4F4;			}		-->		</style><title>Simulado On-Line</title></head><body style="background-color: #C0C0C0" link="#000000" alink="#F4A460" vlink="#800000"><div align="center"><table width="36%" border="0" cellpadding="0" cellspacing="0" >  <tr>	<td width="364" align="left" valign="top">	<table width="362"  border="0" cellspacing="0" cellpadding="0">	  <tr align="left" valign="top">		<td width="355" height="100%">		<table width="355"  border="0" cellspacing="0" cellpadding="0" height="496">		  <tr>			<td align="left" valign="top" style="border-top:5px solid #EBEBEB" height="496" width="355">			<table width="107%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#EBEBEB" height="1">			  <tr align="left" valign="top">				<td width="381" height="1" bgcolor="#FFFFFF">				<table width="354"  border="1" cellspacing="0" cellpadding="0" style="height:491px " bordercolor="#C0C0C0">				  											<TD HEIGHT="489" style="border-left-style:solid; border-left-width:1; border-right-style:solid; border-right-width:1; border-top-style:none; border-top-width:medium; border-bottom-style:solid; border-bottom-width:1" width="460"> 	  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" bordercolor="#111111" width="100%" id="AutoNumber18">		<tr>		  <td width="100%" style="border-style: none; border-width: medium"><tr>						  <td width="100%" style="border-style: none; border-width: medium" height="273">						  <p align="center">						  <%sql3 = "SELECT * FROM usuarios WHERE login = '" & Session("username") & "'"Set rs3 = Server.CreateObject("ADODB.Recordset")rs3.CursorType = 3rs3.CursorLocation = 3rs3.LockType = 3rs3.Open sql3, conn%> 																					<table border="1" cellspacing="1" style="border-collapse: collapse; border-left-width:0px; border-right-width:0px" width="100%" height="39">																	 <tr>		<td width="39%" valign="top" style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: solid; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px">		<p style="text-align: center"><b><font size="2" color="#800000">Disciplina:</font></b></td>		<td width="59%" style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: solid; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px">				 <%=rs2("disciplina")%></td>	  </tr></td>								</tr>							</table>							<center><p style="margin-left: 12; margin-right: 12"><font size="2" face="Tahoma">Usuário: <%=Session("username")%> <br>Pontos: <%=rs3("pontos")%> <Br><br><b>Aviso:</b> Você tem exatamente <b>1 minuto</b> pra responder a pergunta, caso não responda, você precisará fazer o login novamente! </font> </p><p style="margin-left: 12; margin-right: 12"> </p></center></p><form method="POST" action="responde.asp" name="responde">						   	<center>	<table border="0" width="94%" cellspacing="0" cellpadding="0" height="115">	  <tr>		<td width="100%" height="31" bgcolor="#800000"><font color="#FFFFFF" size="2" face="Tahoma">  <%=rs2("pergunta")%></font></td>	  </tr>	  <tr>		<td width="100%" height="21"><input type="radio" value="1" name="resposta" style="font-family: Tahoma; font-size: 8 pt; color: #000000; border: 1px dashed #800000;; background-color:#800000"><font size="2" face="Tahoma"><%=rs2("resp1")%></font></td>	  </tr>	  <tr>		<td width="100%" height="21"><input type="radio" value="2" name="resposta" style="font-family: Tahoma; font-size: 8 pt; color: #000000; border: 1px dashed #D2691E;; background-color:#800000"><font size="2" face="Tahoma"><%=rs2("resp2")%></font></td>	  </tr>	  <tr>		<td width="100%" height="21"><input type="radio" value="3" name="resposta" style="font-family: Tahoma; font-size: 8 pt; color: #000000; border: 1px dashed #D2691E;; background-color:#800000"><font size="2" face="Tahoma"><%=rs2("resp3")%></font></td>	  </tr>	  <tr>		<td width="100%" height="21"><input type="radio" value="4" name="resposta" style="font-family: Tahoma; font-size: 8 pt; color: #000000; border: 1px dashed #D2691E;; background-color:#800000"><font size="2" face="Tahoma"><%=rs2("resp4")%></font></td>	  </tr>	  <tr>		<td width="100%" height="21"></td>	  </tr>	</center>	  <tr>		<td width="100%" height="21">		  <p align="center">		  <input border="0" src="img/responder.png" name="I1" type="image" WIDTH="120" HEIGHT="35" style="font-family: Tahoma; font-size: 8 pt; color: #008000; border: 0px dashed #fffff;; background-color:#FFFFCC"></td>	  </tr>	</table>    <input type="hidden" name="id" value="<%=rs2("id")%>"></form><p align="center"><br><a href="logout.asp"><img border="0" src="img/logout.gif" WIDTH="58" HEIGHT="15"></a><%end if %></body></html></td>						</tr>		 </td>		</tr>	  </table>	  <TABLE WIDTH="50%" BORDER="0" ALIGN="CENTER" CELLPADDING="0">			  </TABLE>	  </TD>  </TR></td>				  </tr>				  </table>				</td>							  </tr>			</table></td>		  </tr>		  </table></td>	  </tr>	</table></td>  </tr></table></div></body></html>

 

o erro é este:

 

 

Tipo de erro:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)

[Microsoft][Driver ODBC para Microsoft Access] Parâmetros insuficientes. Eram esperados 2.

/simulado/simulado.asp, line 34

Compartilhar este post


Link para o post
Compartilhar em outros sites

Como está o form que envia esses dados?

Compartilhar este post


Link para o post
Compartilhar em outros sites

o form é este aqui!!seleciona_disciplina.asp<% @LANGUAGE=VBSCRIPT %><!--#include file="config.inc" --><%Response.AddHeader "pragma","no-cache"Response.AddHeader "cache-control","private"Response.CacheControl = "no-cache"Response.CacheControl = "no-cache"if Session("brquiz") <> "logado" thenResponse.Redirect("login.asp")sql3 = "SELECT * FROM usuarios WHERE login = '" & Session("username") & "'"Set rs3 = Server.CreateObject("ADODB.Recordset")rs3.CursorType = 3rs3.CursorLocation = 3rs3.LockType = 3rs3.Open sql3, connelse%><%'Seta as conecaoSet conn = Server.CreateObject("ADODB.Connection")'Seta os registrosset rs = server.createobject("adodb.RecordSet")'Seta caminho para abrir bancoconn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("bd/simulado.mdb")'ConsultaSQL = "SELECT * FROM disciplinas Order By descricao Desc"'Abre conexaors.open sql, conn, 3, 3'Acerta a posição do cursor'rs.CursorLocation = adUseClient'Define o tamanho do Cache = para o número de páginasrs.CacheSize = 30'Move o cursor para a primeira linhars.MoveFirst%><html><head><meta http-equiv="Content-Language" content="pt-br"><META http-equiv=Content-Type content="text/html; charset=windows-1252"><LINK HREF="style1.css" TYPE="text/css" REL="stylesheet"><LINKhref="default.css"type=text/css rel=stylesheet><script src="codigos.js"type=text/javascript></SCRIPT><style type="text/css"><!--a:active{text-decoration: none;color: #333333;}a:hover{text-decoration: none;color: #000000;}a:link{text-decoration: none;color: #333333;}a:visited{text-decoration: none;color: #333333;}.Texto1{font-family: Verdana;font-size: 10px;font-weight: none;color: #000000;text-decoration: none;}.Texto2{font-family: Verdana;font-size: 10px;font-weight: bold;color: #000000;text-decoration: none;}.Borda1{border: 1px solid #999999;}.Form1{border: 1px solid #999999;font-family: Verdana;font-size: 12px;color: #000000;text-decoration: none;background-color: #F4F4F4;}--></style><title>Simulado On-Line</title></head><center><body style="background-color: #C0C0C0" link="#000000" alink="#800000" vlink="#7D7D7D"><table width="42%" border="0" cellpadding="0" cellspacing="0" ><tr><td width="422" align="left" valign="top"><div align="center"><table width="422" border="0" cellspacing="0" cellpadding="0"><tr align="left" valign="top"><td width="422" height="100%"><div align="center"><table width="356" border="0" cellspacing="0" cellpadding="0" height="237"><tr><td align="center" valign="top" style="border-top:5px solid #EBEBEB" height="237" width="356"><table width="50%" border="0" cellpadding="0" cellspacing="0" bgcolor="#EBEBEB" height="1"><tr align="left" valign="top"><td width="359" height="1" bgcolor="#FFFFFF"><div align="center"><table width="421" border="1" cellspacing="0" cellpadding="0" style="height:232px " bordercolor="#C0C0C0"><TR><TD HEIGHT="230" style="border-left-style:solid; border-left-width:1; border-right-style:solid; border-right-width:1; border-top-style:none; border-top-width:medium; border-bottom-style:solid; border-bottom-width:1" width="417" bgcolor="#FFFFFF"><table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-left-width:0; border-right-width:0; border-bottom-width:0" bordercolor="#C0C0C0" width="98%" id="AutoNumber18" height="226"><tr><td width="98%" style="border-style: none; border-width: medium" height="225" bordercolor="#C0C0C0" bgcolor="#FFFFFF"><p align="center"><font face="Verdana"><font size="2"><b><font color="#D2691E"><br> </font><font color="#800000">Sejabem vindo ao</font><font color="#D2691E"> </font></b> </b> <strong>Simulado On-line</em></strong></font><b><font size="2" color="#D2691E"><em><br></font></b></font><p align="center"><img src="img/Simulado.png" width="166" height="100" border="0"><p align="center"><b><font size="3" face="Verdana" color="#800000">Selecione a Disciplina</font><font size="2" face="Verdana" color="#800000"></font></b><table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" bordercolor="#111111" width="419" id="AutoNumber3" height="91"><tr><td width="419" style="border-style: none; border-width: medium" height="1"><tr><td height="90" valign="top" align="center" style="border-style:none; border-width:medium; " width="419"><table border="1" cellspacing="1" style="border-collapse: collapse; border-right-width:0px" width="99%"><tr><% Do while not rs.eof %><tr><td align="left" valign="top" style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium"><p align="center"></a></b><br></b><br><font face="Verdana" size="2" color="#00080"><%=rs("descricao")%><br><a href="simulado.asp?id2=<%=rs("descricao")%>"><font face="Verdana" size="2" color="#00000">[ Acessar Simulado ]<br></tr><%rs.movenextloop%></td></tr></table></td></tr></td></tr></table><p style="text-align: center"><b><font size="2" face="Verdana"><a href="../index.asp">Voltar</a></font></b></td></tr></td></tr></table><TABLE WIDTH="50%" BORDER="0" ALIGN="CENTER" CELLPADDING="0"></TABLE></TD></TR></td></tr></table></div></td></tr></table></td></tr></table></div></tr></table></div></center></table></body><%end if%></html>

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.