Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Pedi ajuda aqui hoje e recebi ajuda pra fazer aparecer os botões de editar e excluir, que não estvam aparecendo. Agora apareceram, mas o botão de editar não está editando e eu não sei como funciona a lógica dessa página, pois peguei ela semi-pronta, pra mudar pouquiíssimas coisas. Alguem pode me ajudar a entender o que está acontecendo?
Vou colocar aki só o que interessa na minha página, ok?
df_consulta.asp
<script language="JavaScript">
<!--
function abre_foto(width, height, nome) {
var top; var left;
top = ( (screen.height/2) - (height/2) )
left = ( (screen.width/2) - (width/2) )
window.open('',nome,'width='+width+',height='+height+',scrollbars=yes,toolbar=no,location=no,status=no,menubar=no,resizable=no,lef
t='+left+',top='+top);
}
function confirm_delete(form) {
if (confirm("Tem certeza que deseja excluir o registro?")) {
document[form].action = '<%=Request.ServerVariables("SCRIPT_NAME")%>';
document[form].submit();
}
}</SCRIPT>
.
.
.
<td height="76" colspan="8"><p class="texto_pagina">
<% dim solut
solut= request("solut")
if solut="" then %>
Links: <a href="<%=pagina_consulta%>" class="texto_pagina">Página de Consulta</a> | <a href="<%=pagina_inclusao%>" class="texto_pagina">Página de Inclusão</a>
| <a href="../../ATN/Admin/PPrincipal.asp">Voltar para Administrador</a>
<% end if%>
</p>
<a href="<%=pagina_inclusao%>" class="texto_pagina"><hr size=1 color=gainsboro>
</a><span class="texto_pagina">
<% Select Case Request.QueryString("Submit")
Case "Anterior" : PagAtual = PagAtual - 1
Case "Proxima" : PagAtual = PagAtual + 1
Case "Menos" : NumPagMax = NumPagMax - VarPagMax
Case "Mais" : NumPagMax = NumPagMax + VarPagMax
Case Else : PagAtual = CInt(Request.QueryString("Submit"))
End Select
If NumPagMax < PagAtual then
NumPagMax = NumPagMax + VarPagMax
End If
If NumPagMax - (VarPagMax - 1) > PagAtual then
NumPagMax = NumPagMax - VarPagMax
End IfSet objCon = Server.CreateObject("ADODB.Connection")
objCon.Open strCon
If (Session("login") = "logado") Then
If Request.Form("recordno") <> "" Then
Set objRS_delete = Server.CreateObject("ADODB.Recordset")
objRS_delete.CursorLocation = 3
objRS_delete.CursorType = 0
objRS_delete.LockType = 3
strQ_delete = Request.Form("strQ")
indice = Trim(Request.Form("indice"))
If indice <> "" Then strQ_delete = " SELECT * FROM tabprodutos WHERE " & indice
objRS_delete.Open strQ_delete, objCon, , , &H0001
If indice = "" Then objRS_delete.Move Request.Form("recordno") - 1
If Not objRS_delete.EOF Then
objRS_delete.Delete
objRS_delete.UpdateBatch
End IF
objRS_delete.Close
Set objRS_delete = Nothing
Set strQ_delete = Nothing
End If
End If
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.CursorLocation = 3
objRS.CursorType = 2
objRS.LockType = 1
objRS.CacheSize = RegPorPag
strQ = "SELECT * FROM tabprodutos"
If Trim(Request("string_busca")) <> "" Then
If Trim(Request("campo_busca")) <> "" Then
strQ = strQ & " Where " & Trim(Request("campo_busca")) & " LIKE '%" & Trim(Request("string_busca")) & "%'"
Else
strQ = strQ & " Where 1 <> 1"
strQ = strQ & " Or codigobd LIKE '%" & Trim(Request("string_busca")) & "%'"
strQ = strQ & " Or lancamento LIKE '%" & Trim(Request("string_busca")) & "%'"
strQ = strQ & " Or foto LIKE '%" & Trim(Request("string_busca")) & "%'"
strQ = strQ & " Or titulo LIKE '%" & Trim(Request("string_busca")) & "%'"
strQ = strQ & " Or autor LIKE '%" & Trim(Request("string_busca")) & "%'"
strQ = strQ & " Or assunto LIKE '%" & Trim(Request("string_busca")) & "%'"
strQ = strQ & " Or release LIKE '%" & Trim(Request("string_busca")) & "%'"
strQ = strQ & " Or paginas LIKE '%" & Trim(Request("string_busca")) & "%'"
strQ = strQ & " Or formato LIKE '%" & Trim(Request("string_busca")) & "%'"
strQ = strQ & " Or preco LIKE '%" & Trim(Request("string_busca")) & "%'"
strQ = strQ & " Or pchave LIKE '%" & Trim(Request("string_busca")) & "%'"
strQ = strQ & " Or status LIKE '%" & Trim(Request("string_busca")) & "%'"
'Ver dps o q tah acontecendo com essa lnha abaixo; pciso fzr uma cosulta p deixar os lançamentos na frente
'RS.Open "SELECT * FROM tabprodutos WHERE lancamento = " & Text1.Text & "" & " ORDER BY lancamento"
End If'End If
objRS.Open strQ, objCon, , , &H0001
objRS.PageSize = RegPorPag
Set objRS_indice = Server.CreateObject("ADODB.Recordset")
objRS_indice.CursorLocation = 2
objRS_indice.CursorType = 0
objRS_indice.LockType = 2
strQ_indice = "SELECT * FROM tabprodutos WHERE 1 <> 1"
objRS_indice.Open strQ_indice, objCon, , , &H0001
indice = ""
For Each item In objRS_indice.Fields
If item.properties("IsAutoIncrement") = True Then
indice = item.name
Exit For
End If
Next
objRS_indice.Close
Set objRS_indice = Nothing
Set strQ_indice = Nothing
Set objRS.ActiveConnection = Nothing
objCon.Close
Set objCon = Nothing
%>
<B>Consultar Registros</B><BR>Visualize os registros da
tabela abaixo:<BR>
</span>
<FORM name="form_busca" method="post" action="<%=Request.ServerVariables("SCRIPT_NAME")%>">
<span class="texto_pagina">
Pesquizar por <INPUT type=text name=string_busca value="<%=Request("string_busca")%>" class=texto_pagina>
em <SELECT name=campo_busca class=texto_pagina>
<OPTION value="" selected>Registros</OPTION>
<OPTION value="titulo" <% If Trim(Request("campo_busca")) = Trim("titulo") Then : Response.Write "selected" : End If %>>Título</OPTION>
<OPTION value="autor" <% If Trim(Request("campo_busca")) = Trim("autor") Then : Response.Write "selected" : End If %>>Autor</OPTION>
<OPTION value="assunto" <% If Trim(Request("campo_busca")) = Trim("assunto") Then : Response.Write "selected" : End If %>>Assunto</OPTION>
<OPTION value="preco" <% If Trim(Request("campo_busca")) = Trim("preco") Then : Response.Write "selected" : End If %>>Preço R$</OPTION>
</SELECT>
<INPUT type="submit" name="submit" value="ok" class=texto_pagina style="color: black">
</span>
</FORM>
<span class="texto_pagina">
<%Foram encontrados <%= objRS.RecordCount%> registros<BR>
<BR>
</span>
<TABLE width="100%" border=0 cellpadding=0 cellspacing=0>
<TR class=titulos_registros>
<%If Right(Request.QueryString("Ordem"), 3) = "desc" Then
Ordem = "desc"
Else
Ordem = "asc"
End IF
%>
<TD colspan="10" valign=top nowrap style="cursor: hand" onClick="window.open('<%=Request.ServerVariables("SCRIPT_NAME")%>?Ordem=codigobd+<%=Ordem%>', '_self')"> </TD>
</TR>
<% <TR class=exibe_registros>
<% Response.Write "<FORM name=""form_edit_" & Cont & """ action=""" & pagina_alteracao & """ method=post>"
Response.Write "<TD align=""center"" nowrap style=""background-color: gainsboro"" nowrap> "
If indice <> "" Then Response.Write "<input type=""hidden"" name=""indice"" value=""" & indice & "=" & objRS.Fields.Item(indice).Value & """>"
Response.Write "<INPUT type=hidden name=recordno value=""" & (objRS.AbsolutePosition) & """>"
Response.Write "<INPUT type=hidden name=strQ value=""" & strQ & """>"
Response.Write "<INPUT type=image src=""imagens\edit.gif"" alt=""Alterar Registro"" name=alterar value=alterar>"
If (Session("login") = "logado") Then
Response.Write " <IMG src=""imagens\delete.gif"" alt=""Excluir Registro"" name=delete border=0 style=""cursor:hand"" OnClick=""confirm_delete('form_edit_" & Cont & "')"">" Response.Write " </TD>"
Response.Write "</FORM>" <TD width="14%" rowspan="6" class="texto_pagina"><a href="<%=(objRS.Fields.Item("link").Value)%>" onClick="abre_foto(350, 350, 'janela_foto')" target="janela_foto"><img src="<%=(objRS.Fields.Item("foto").Value)%>" border=0 width=100 height="125"></a></TD>
<TD width="3%" class="texto_pagina">
<%If Left(Request.QueryString("Ordem"), 6) = "titulo" Then : Response.Write "<img src=""imagens\ordem_" & Ordem & ".gif"" width=9 height=10> " : End If%> </TD>
<TD width="7%" class="texto_pagina"><b>Título:</b></TD>
<TD width="24%" class="texto_pagina"><%=(objRS.Fields.Item("titulo").Value)%></TD>
<TD colspan="6" class="texto_pagina">
<%If Left(Request.QueryString("Ordem"), 7) = "release" Then : Response.Write "<img src=""imagens\ordem_" & Ordem & ".gif"" width=9 height=10> " : End If%>
<b>Release do livro</b></TD>
</TR>
<TR class=exibe_registros>
<TD class="texto_pagina">
<%If Left(Request.QueryString("Ordem"), 5) = "autor" Then : Response.Write "<img src=""imagens\ordem_" & Ordem & ".gif"" width=9 height=10> " : End If%> </TD>
<TD class="texto_pagina"><b>Autor:</b></TD>
<TD class="texto_pagina"><%=(objRS.Fields.Item("autor").Value)%></TD>
<TD colspan="6" rowspan="5" class="texto_pagina"><%=(objRS.Fields.Item("release").Value)%></TD>
</TR>
<TR class=exibe_registros>
<TD class="texto_pagina">
<%If Left(Request.QueryString("Ordem"), 7) = "assunto" Then : Response.Write "<img src=""imagens\ordem_" & Ordem & ".gif"" width=9 height=10> " : End If%> </TD>
<TD class="texto_pagina"><b>Assunto:</b></TD>
<TD class="texto_pagina"><%=(objRS.Fields.Item("assunto").Value)%></TD>
</TR>
<TR class=exibe_registros>
<TD class="texto_pagina">
<%If Left(Request.QueryString("Ordem"), 7) = "paginas" Then : Response.Write "<img src=""imagens\ordem_" & Ordem & ".gif"" width=9 height=10> " : End If%> </TD>
<TD class="texto_pagina"><b>Páginas:</b></TD>
<TD class="texto_pagina"><%=(objRS.Fields.Item("paginas").Value)%></TD>
</TR>
<TR class=exibe_registros>
<TD class="texto_pagina">
<%If Left(Request.QueryString("Ordem"), 7) = "formato" Then : Response.Write "<img src=""imagens\ordem_" & Ordem & ".gif"" width=9 height=10> " : End If%> </TD>
<TD class="texto_pagina"><b>Formato:</b></TD>
<TD class="texto_pagina"><%=(objRS.Fields.Item("formato").Value)%></TD>
</TR>
<TR class=exibe_registros>
<TD class="texto_pagina">
<%If Left(Request.QueryString("Ordem"), 5) = "preco" Then : Response.Write "<img src=""imagens\ordem_" & Ordem & ".gif"" width=9 height=10> " : End If%> </TD>
<TD class="texto_pagina"><b>Preço:</b></TD>
<TD class="texto_pagina style61"><%=(objRS.Fields.Item("preco").Value)%></TD>
</TR>
<TR>
<TD class="texto_pagina"><a href="<%=(objRS.Fields.Item("link").Value)%>"><img src="imagens/comprar.jpg" width="99" height="42" border="0"></a></TD>
<TD> </TD>
<TD colspan="2"><span class="style62"><%=(objRS.Fields.Item("status").Value)%></span></TD>
<TD width="3%"> </TD>
<TD width="10%"> </TD>
<TD width="10%"> </TD>
<TD width="10%"> </TD>
<TD width="10%"> </TD>
<TD width="9%"> </TD>
</TR>
<TR>
<TD colspan="10" background="imagens/linha_horizontal1.jpg"> </TD>
</TR>
<%
objRS.MoveNext
If objRS.Eof then Exit For <TR>
<TD colspan="13" class="texto_pagina">
<%LinksNavegacao()%> </TD>
</TR>
</TABLE>
<p>
<span class="texto_pagina">
<%
If indice = "" Then
Response.Write "<BR><B>ATENÇÃO:</B> Crie um campo do tipo <i>AutoIncrement</i> com qualquer nome em sua tabela para evitar erros na alteração dos dados. "
Response.Write "<a href=""[http://www.dataform.com.br/criar_campo_autoincrement.asp""](http://www.dataform.com.br/criar_campo_autoincrement.asp) target=""_blank"">Clique aqui</a> para mais detalhes."
End If
objRS.Close
Set objRS = Nothing <BR>
<B>Nenhum registro foi encontrado</B><BR>
</span><BR>
<%Response.Write "<TABLE border=0 cellPadding=2 cellSpacing=0 class=tabela_paginacao>"
Response.Write "<TR><TD align=center vAlign=top noWrap colspan=5>" Response.Write " <A href=""" & Request.ServerVariables("SCRIPT_NAME") & "?solut=1&PagAtual=" & PagAtual & "&VarPagMax=" & VarPagMax & "&NumPagMax=" & NumPagMax & "&Submit=" & i & "&Ordem=" & Request.QueryString("Ordem") & "&string_busca=" & Server.URLEncode(Request("string_busca")) & "&campo_busca=" & Server.URLEncode(Request("campo_busca")) & """ class=links_paginacao>" & i & "</A> "
Else
If PagAtual <> TotPag Then
Response.Write " " & i & " "
End If
End If
End IfSe não for pedir mto, alguem pode me ajudar a entender onde está o problema?
Se pcisar de mais informação, me avisem tah!
Carregando comentários...