Ir para conteúdo

POWERED BY:

Arquivado

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

Eric de S.

Problemas na linguagem asp

Recommended Posts

Olá trabalho em um site de bolsas na internet e estou com problemas com o conteudo asp esta ocorrendo um erro na programação e não sei como identificalo dentro da área de pedidos ( as compras dos clientes no site ) me aparece o seguinte erro:

 

error '80020009'

/adm/pedidos.asp, line 149

 

Falei com o meu chefe e ele me falou pra min Analisar o código e descubrir o erro disse que é a soma do valor das bolsas e o frete.

 

e para min ver qual das duas esta com erro imprimindo na pagina o valor de cada  response.write(variável)

 

Não entendi nada pois não manjo absolutamente nada de asp !!!!! prescizo de alguem que me de uma grande força nisso se não amanha vou perder o emprego posso ate negociar um $$$ pra quem ajudar !

 

Anexei o codigo da pagina pedidos.asp quaso algum bom samaritano possa resolvelo

 

<!-- #include file="include/conexao.inc"-->
<!-- #include file="include/funcoes.inc"-->
<%
if Request.QueryString("act")="logout" then
	Session("USER")=""
	Session.Abandon()
end if
%>
<%
if request.form("Atualizar")="Atualizar" then
	sqlxxx="update t_entrega set Status="+cstr(Request.Form("Status"))
	IF len(request.form("Frete"))>3 then
		sqlxxx=sqlxxx+" ,Frete=CONVERT(money,'"+CSTR(replace(request.form("Frete"),",","."))+"') "
	end if
	sqlxxx=sqlxxx+" where pedido="+cstr(request.QueryString("ped"))

	set rstmp=conexao.execute(sqlxxx)
	set rstmp=nothing
	atu=1
end if
%>
<html>
<head>
<meta HTTP-EQUIV="Pragma" Content="no-cache">
<title>KEO'S Bolsas e Acessórios</title>
<style type="text/css">
<!--
.style1 {color: #FF0000}
td.ped2 {border-left: 1px solid #999999; border-bottom: 1px  solid #999999;}
-->
</style>
</head>
<script language="javascript" src="scripts/funcoes.js"></script>
<script language="javascript">
function janela22(lnk,x,y)
 {
  window.open(lnk,"1",'width='+x+',height='+y+',scrollbars');
 }</script>
<link href="SCRIPTS/LINKS.CSS" rel="stylesheet" type="text/css" />
<body bgcolor=#ffffff topmargin="0" leftmargin="0"><font class="txt">
<div align="center">
<%if session("USER")<>"" then%>
<table width="95%" border="0" cellspacing="0" cellpadding="0">
  <tr>
	<th width="130" align="left" valign="top" scope="col"><font class="txt">
	  <table cellpadding="2" cellspacing="10">
		<tr bgcolor="#D9FFDC">
		  <td height="50" bgcolor="#F1D9FF"><a href="default.asp" class=lnk>Olá <%=Session("usr_nome")%>,<br>
			Seja Bem Vindo! </a></td>
		</tr>
		<tr>
		  <td height="50" bgcolor="#D9E7FF"><div align="center"><a href=clientes.asp class=adm>Clientes</a></div></td>
		</tr>
		<tr>
		  <td height="50" bgcolor="#D9E7FF"><div align="center"><a href=cores.asp class=adm>Cores</a></div></td>
		</tr>
		<tr>
		  <td height="50" bgcolor="#D9E7FF"><div align="center"><a href=Enquete.asp class=adm>Enquete</a></div></td>
		</tr>
		<tr>
		  <td height="50" bgcolor="#D9E7FF"><div align="center"><a href=Fornecedores.asp class=adm>Fornecedores</a></div></td>
		</tr>
		<tr>
		  <td height="50" bgcolor="#D9E7FF"><div align="center"><a href=Material.asp class=adm>Material</a></div></td>
		</tr>
		<tr>
		  <td height="50" bgcolor="#D9E7FF"><div align="center"><a href=Produto.asp class=adm>Produto</a></div></td>
		</tr>
		<tr>
		  <td height="50" bgcolor="#D9E7FF"><div align="center"><a href=Sexo.asp class=adm>Sexo</a></div></td>
		</tr>
		<tr>
		  <td height="50" bgcolor="#D9E7FF"><div align="center"><a href=Tamanho.asp class=adm>Tamanho</a></div></td>
		</tr>
		<tr>
		  <td height="50" bgcolor="#D9E7FF"><div align="center"><a href=Tipo.asp class=adm>Tipo</a></div></td>
		</tr>
		<tr>
		  <td height="50" bgcolor="#D9E7FF"><div align="center"><a href=users.asp class=adm>Usuários</a></div></td>
		</tr>
		<tr>
		  <td height="50" bgcolor="#D9E7FF"><div align="center"><a href=pedidos.asp class=adm>Pedidos</a></div></td>
		</tr>
		<tr bgcolor="#FFFFCC">
		  <td height="50"><div align="center"><a href=publicidade.asp class=adm>Publicidade</a></div></td>
		</tr>
		<tr>
		  <td height="50" align="center" valign="middle" bgcolor="#CCCCCC"><div align="center"><a href=estoque.asp class=adm>Espelhar Estoque </a></div></td>
		</tr>
		<tr>
		  <td height="50" bgcolor="#FEEBDE"><div align="center"><a href=default.asp?act=logout class=adm>>>...SAIR...<<</a></div></td>
		</tr>
	  </table>
	</font></th>
	<th align="center" valign="top" scope="col"><table width="100%" border="0" cellspacing="0" cellpadding="0">
	  <tr>
		<th height="30" scope="col">Pedidos
		  <%if Request.QueryString("act")="del" then Response.write(" - Exluir Pedido") %><%if Request.QueryString("act")="edt" then Response.write(" - Editar STATUS do Pedido") %><%if atu=1 then%><font class=txt_v><br><Br>PEDIDO ATUALIZADO COM SUCESSO!!!</font><%end if%></th>
	  </tr>
<%if Request.QueryString("act")="" and Request.QueryString("id")="" then%>
	  <tr>
		<th scope="col"><table width="95%" border="0" cellspacing="0" cellpadding="0">
				  <tr>
			<td width="50" height="20" align="left" valign="middle" ><font class=preco>Pedido</font></td>
			<td height="20" align="center" valign="middle" ><font class=preco>Cliente</font></td>
			<td height="20" align="center" valign="middle"><font class=preco>E-mail do Cliente</font></td>
			<td height="20" align="center" valign="middle"><font class=preco>Qtde Total </font></td>
			<td height="20" align="center" valign="middle" bgcolor="#FBF2FF"><font class=preco>Valor Produtos </font></td>
			<td align="center" valign="middle" bgcolor="#FBF2FF"><font class=preco>Valor Frete </font></td>
			<td width="120" align="center" valign="middle"><font class=preco>Data Fechamento </font></td>
			<td width="100" align="center" valign="middle"><font class=preco>STATUS</font></td>
			<td width="80" align="center" valign="middle" bgcolor="#FFECEC"><font class=preco>TOTAL FINAL </font></td>
			<td width="30"><font class=preco>Edt</font></td>
			<td width="30" height="20"><font class=preco>Ver</font></td>
			<td width="30" height="20" align="center"><font class=preco>Del</font></td>
		  </tr>

		<%
		sql_tmp="select pedido, data_fechado, cliente from t_pedido group by pedido, data_fechado,cliente"
		set rs2=conexao.execute(sql_tmp)

		do while not rs2.eof

			sql= "select * from t_pedido where pedido="+cstr(rs2("pedido"))
			set rs=conexao.execute(sql)

			tot_vlr=ccur(0)
			tot_qtd=0

			do while not rs.eof
				sql= "select * from t_produto where ref_keos="+cstr(right(rs("produto"),5))
				set rs3=conexao.execute(sql)

				if contar(rs3)>0 then
					tot_vlr=tot_vlr+(ccur(rs3("preco_a"))*cint(rs("qtde")))
					tot_qtd=tot_qtd+cint(rs("qtde"))
				end if
				rs.movenext
			loop

			sql= "select * from t_clientes where id="+cstr(rs2("cliente"))
			set rs=conexao.execute(sql)
			cliente=rs("nome")
			email=rs("Email")

			sql= "select Frete,* from t_Entrega where pedido="+cstr(rs2("pedido"))
			set rsttt2=conexao.execute(sql)

			total_final=ccur(rsttt2("frete"))+ccur("tot_vlr")


			if r=1 then
				bg="#E3F9F7"
				r=0
			else
				bg="#ffffff"
				r=1
			end if

		%>
		  <tr bgcolor=<%=bg%>>
			<td width="50" height="20" align="left" valign="middle" bgcolor=<%=bg%>><font class=txt><%=rs2("pedido")%></font></td>
			 <td height="20" align="center" valign="middle" bgcolor=<%=bg%>><a href=clientes.asp?act=view&id=<%=rs2("cliente")%> class=lnk><%=cliente%></a></td>
			<td height="20" align="center" valign="middle" bgcolor=<%=bg%>><font class=txt><%=email%></font></td>
			<td height="20" align="center" valign="middle" bgcolor=<%=bg%>><font class=txt><%=tot_qtd%></font></td>
						<td height="20" align="center" valign="middle" bgcolor=<%=bg%>><font class=txt>R$ <%=moeda("tot_vlr")%></font></td>
						<td align="center" valign="middle"><font class=txt>R$ <%=moeda(rsttt2("Frete"))%></font></td>
						<td width="120" align="center" valign="middle" bgcolor=<%=bg%>><font class=txt><%=rs2("data_fechado")%></font></td>
						<td width="130" align="center" valign="middle" bgcolor=<%=bg%>><font class=txt><%
						sqltemp="select T_Status.Status from t_entrega,T_Status where T_Status.id=t_entrega.status and t_entrega.PEDIDO="+cstr(rs2("pedido"))
						set rstmp= conexao.execute(sqltemp)
						response.write(ccur(rstmp("status")))
						set rstmp=nothing
						%></font></td>
						<td width="80" align="center" valign="middle"><font class=txt>
						R$ <%=moeda("total_final")%>
						</font></td>
						<td width="30" align="center" valign="middle" bgcolor=<%=bg%>><a href="pedidos.asp?act=edt&ped=<%=rs2("pedido")%>"><img src="images/EDT.gif" width="16" alt="Editar o Status do pedido." height="14" border=0></a></td>
				  <td width="30" height="20" bgcolor=<%=bg%>><a href="java script:janela22('print_ped_adm.asp?ped=<%=rs2("pedido")%>',600,600)"><img src="images/print.gif" width="16" alt="Imprimir seu pedido." height="14" border=0></a><a href=pedidos.asp?act=view&id=<%=rs2("pedido")%>></a></td>
			<td width="30" height="20" align="center" bgcolor=<%=bg%>><input type="image" name="imageField" src="images/delete.gif" onMouseOut="window.status=''" onMouseOver="window.status='Exluir este item!'" onClick="java script:if(confirm('Deseja Realmente EXCLUIR???')){location.href='pedidos.asp?act=del&id=<%=rs2("pedido")%>';}{return false;}"></td>
		  </tr>
		  <%
		  rs2.movenext
		  loop%>
		</table></th>
	  </tr>
	  <%end if%>
	  <%if Request.QueryString("act")="del" then
	  sql= "delete from t_pedido where pedido="+Request.QueryString("ID")
	  set rs=conexao.execute(sql)
		sql= "delete from t_entrega where pedido="+Request.QueryString("ID")
	  set rs=conexao.execute(sql)
	  %>
	  <tr>
		<td><div align="center" class="style1">
		  <p> </p>
		  <p> </p>
		  <p>PEDIDO EXLUÍDO!</p>
		  <p> </p>
		  <p>
			<input name="Limpar2" type="button" id="Limpar2" value="Voltar" tabindex="18" style='font-family: MS Sans Serif; font-size: 8pt; background-color: rgb(255,255,255); color: rgb(110,110,110); font-weight: Bold; border-left: 1px solid rgb(127,127,185); border-right: 1px solid rgb(127,127,185); border-top: 1px solid rgb(127,127,185); border-bottom: 1px solid rgb(127,127,185);height:25px;width:100px' onClick="location.href='pedidos.asp'">
		  </p>
		</div></td>
	  </tr>
	  <%end if%>
	  <%if Request.QueryString("act")="edt" then%>
	  <tr>
		<th scope="col"><form action="pedidos.asp?act=edt&ped=<%=request.QueryString("ped")%>" method=post>
		<table width="90%" border="0" cellspacing="0" cellpadding="0">
			<tr>
			  <td height="20" > </td>
			  <td height="20" > </td>
			  <td height="20"> </td>
			  <td height="20"> </td>
			  <td height="20"> </td>
			  <td> </td>
			  <td width="80"> </td>
			  <td> </td>
			</tr>
			<tr>
			  <td height="20" > </td>
			  <td height="20" > </td>
			  <td height="20"> </td>
			  <td height="20"> </td>
			  <td height="20"> </td>
			  <td> </td>
			  <td width="80"> </td>
			  <td> </td>
			</tr>
			<tr>
			  <td height="20" > </td>
			  <td height="20" > </td>
			  <td height="20"> </td>
			  <td height="20"> </td>
			  <td height="20"> </td>
			  <td> </td>
			  <td width="80"> </td>
			  <td> </td>
			</tr>
			<tr>
			  <td width="50" height="20" ><font class=preco>Pedido</font></td>
			  <td height="20" ><font class=preco>Cliente</font></td>
			  <td height="20"><font class=preco>E-mail do Cliente</font></td>
			  <td height="20"><font class=preco>Qtde Total </font></td>
			  <td height="20"><font class=preco>Valor PRODUTOS </font></td>
			  <td width="120"><font class=preco>Data Fechamento </font></td>
			  <td width="80"><font class=preco>Valor FRETE </font></td>
			  <td width="30"><font class=preco>STATUS</font></td>
			  </tr>
			<%
		sql_tmp="select pedido, data_fechado, cliente from t_pedido where pedido="+cstr(request.querystring("ped"))+" group by pedido, data_fechado,cliente"
		set rs2=conexao.execute(sql_tmp)

			sql= "select * from t_pedido where pedido="+cstr(rs2("pedido"))
			set rs=conexao.execute(sql)

			tot_vlr=ccur(0)
			tot_qtd=0

			do while not rs.eof
				sql= "select * from t_produto where ref_keos="+cstr(right(rs("produto"),5))
				set rs3=conexao.execute(sql)

				if contar(rs3)>0 then
					tot_vlr=tot_vlr+(ccur(rs3("preco_a"))*cint(rs("qtde")))
					tot_qtd=tot_qtd+cint(rs("qtde"))
				end if
				rs.movenext
			loop

			sql= "select * from t_clientes where id="+cstr(rs2("cliente"))
			set rs=conexao.execute(sql)
			cliente=rs("nome")
			email=rs("Email")

			if r=1 then
				bg="#E3F9F7"
				r=0
			else
				bg="#ffffff"
				r=1
			end if

		%>
			<tr bgcolor=<%=bg%>>
			  <td width="50" height="20" bgcolor=<%=bg%>><font class=txt><%=rs2("pedido")%></font></td>
			  <td height="20" bgcolor=<%=bg%>><a href=clientes.asp?act=view&id=<%=rs2("cliente")%> class=lnk><%=cliente%></a></td>
			  <td height="20" bgcolor=<%=bg%>><font class=txt><%=email%></font></td>
			  <td height="20" bgcolor=<%=bg%>><font class=txt><%=tot_qtd%></font></td>
			  <td height="20" bgcolor=<%=bg%>><font class=txt>R$ <%=moeda(tot_vlr)%></font></td>
			  <td width="120" bgcolor=<%=bg%>><font class=txt><%=rs2("data_fechado")%></font></td>
			  <td width="80" align="center" valign="middle" bgcolor=<%=bg%>><font class=txt><%
			  sql= "select Frete,* from t_Entrega where pedido="+cstr(rs2("pedido"))
			set rsttt=conexao.execute(sql)

			  %>

				<input name="Frete" type="text" tabindex="12"  size="10" maxlength="14" <%=estilo%> onKeyPress="return(digit_money(this,event))" <%="Value='"+cstr(moeda(rsttt("frete")))+"'"%>></font></td>
			  <td width="30" align="center" valign="middle" bgcolor=<%=bg%>>
			  <%
			  sql_tmp="select * from t_Status"
			  set rstmp=conexao.execute(sql_tmp)

			  sql_tmp="select Status from t_Entrega where PEDIDO="+cstr(rs2("pedido"))
			  set rs2tmp=conexao.execute(sql_tmp)
			  %>
			  <select name="Status">
			  <%
			  Do while not rstmp.eof
			  %>
			  <option <%if rstmp("id")=rs2tmp("Status") then response.Write("Selected") End if %> value="<%=rstmp("id")%>"><%=rstmp("Status")%></option>
			  <%
			  rstmp.movenext
			  loop
			  %>
			  </select>			  </td>
			  </tr>
			<tr bgcolor=<%=bg%>>
			  <td height="20" bgcolor=<%=bg%>> </td>
			  <td height="20" bgcolor=<%=bg%>> </td>
			  <td height="20" bgcolor=<%=bg%>> </td>
			  <td height="20" bgcolor=<%=bg%>> </td>
			  <td height="20" bgcolor=<%=bg%>> </td>
			  <td bgcolor=<%=bg%>> </td>
			  <td width="80" align="center" valign="middle" bgcolor=<%=bg%>> </td>
			  <td align="center" valign="middle" bgcolor=<%=bg%>> </td>
			</tr>
			<tr bgcolor=<%=bg%>>
			  <td height="20" bgcolor=<%=bg%>> </td>
			  <td height="20" bgcolor=<%=bg%>> </td>
			  <td height="20" bgcolor=<%=bg%>> </td>
			  <td height="20" bgcolor=<%=bg%>> </td>
			  <td height="20" bgcolor=<%=bg%>> </td>
			  <td bgcolor=<%=bg%>> </td>
			  <td width="80" align="center" valign="middle" bgcolor=<%=bg%>> </td>
			  <td align="center" valign="middle" bgcolor=<%=bg%>> </td>
			</tr>
			<tr bgcolor=<%=bg%>>
			  <td height="20" bgcolor=<%=bg%>> </td>
			  <td height="20" bgcolor=<%=bg%>> </td>
			  <td height="20" bgcolor=<%=bg%>> </td>
			  <td height="20" bgcolor=<%=bg%>> </td>
			  <td height="20" bgcolor=<%=bg%>> </td>
			  <td bgcolor=<%=bg%>> </td>
			  <td width="80" align="center" valign="middle" bgcolor=<%=bg%>> </td>
			  <td align="center" valign="middle" bgcolor=<%=bg%>> </td>
			</tr>
			<tr bgcolor=<%=bg%>>
			  <td height="20" bgcolor=<%=bg%>> </td>
			  <td height="20" bgcolor=<%=bg%>> </td>
			  <td height="20" bgcolor=<%=bg%>><input name="Limpar22" type="button" id="Limpar22" value="Voltar" tabindex="18" style='font-family: MS Sans Serif; font-size: 8pt; background-color: rgb(255,255,255); color: rgb(110,110,110); font-weight: Bold; border-left: 1px solid rgb(127,127,185); border-right: 1px solid rgb(127,127,185); border-top: 1px solid rgb(127,127,185); border-bottom: 1px solid rgb(127,127,185);height:25px;width:100px' onClick="location.href='pedidos.asp'"></td>
			  <td height="20" bgcolor=<%=bg%>> </td>
			  <td height="20" bgcolor=<%=bg%>> </td>
			  <td bgcolor=<%=bg%>><input name="Atualizar" type="submit" id="Atualizar" value="Atualizar" tabindex="18" style='font-family: MS Sans Serif; font-size: 8pt; background-color: rgb(255,255,255); color: rgb(110,110,110); font-weight: Bold; border-left: 1px solid rgb(127,127,185); border-right: 1px solid rgb(127,127,185); border-top: 1px solid rgb(127,127,185); border-bottom: 1px solid rgb(127,127,185);height:25px;width:100px'></td>
			  <td width="80" align="center" valign="middle" bgcolor=<%=bg%>> </td>
			  <td align="center" valign="middle" bgcolor=<%=bg%>> </td>
			</tr>
		</table>
		</form>

		</th>
	  </tr>
	  <%end if%>
	  <tr>
		<td> </td>
	  </tr>
	</table></th>
  </tr>
</table>
<%Else%>
  <p> </p>
  <%End if%>
</div>
</font>
</body>
</html>
<%
set Conexao = nothing
set rs = nothing
set rs2 = nothing
set rs3 = nothing
%>

 

Desde já oubrigado a todos...

Compartilhar este post


Link para o post
Compartilhar em outros sites

Brother,

 

O intuito dos foruns não é lucrar com as duvidas da galera, e sim ajudar, beleza!

 

O erro 80020009 é:

Inicio e Fim de Arquivos são verdadeiros, ou o registro atual foi cancelado. A operação pedida requer um registro atual. Na maioria das vezes isso acontece quando se tenta procurar um valor em um campo da Base de Dados e a variável que é utilizada para realizar a pesquisa não contem nenhum valor.

 

Tenta isso:

if not rsttt2.EOF then
	total_final=0
else
	total_final=ccur(rsttt2("frete"))+ccur("tot_vlr")
end if

Abraaaaaaaaço

http://forum.imasters.com.br/public/style_emoticons/default/thumbsup.gif

Compartilhar este post


Link para o post
Compartilhar em outros sites

seria bom pra você mesmo explicar para seu chefe que não entende nada de asp.

 

aparentemnte o problema se resolve com a dica do gabrielmelo

Compartilhar este post


Link para o post
Compartilhar em outros sites

Explicando pelo menos ele te daria tempo para aprender e estudar sobre o sistema

Compartilhar este post


Link para o post
Compartilhar em outros sites

Mas o erro continuou na mesma linha?

 

O que gabrielmelo disse está correto. Mas você deve fazer isso em outras partes do código onde você realiza uma consulta SQL.

 

O ideal é você utilizar o if antes da instrução while.

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.